Added some stubbs for the WINE kernel32 regression test
[reactos.git] / reactos / lib / kernel32 / misc / stubs.c
1 /* $Id: stubs.c,v 1.33 2002/09/23 19:20:34 sedwards Exp $
2 *
3 * KERNEL32.DLL stubs (unimplemented functions)
4 * Remove from this file, if you implement them.
5 */
6 #include <windows.h>
7
8
9
10 BOOL
11 STDCALL
12 BaseAttachCompleteThunk (VOID)
13 {
14 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
15 return FALSE;
16 }
17
18
19 BOOL
20 STDCALL
21 CmdBatNotification (
22 DWORD Unknown
23 )
24 {
25 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
26 return FALSE;
27 }
28
29
30 int
31 STDCALL
32 CompareStringA (
33 LCID Locale,
34 DWORD dwCmpFlags,
35 LPCSTR lpString1,
36 int cchCount1,
37 LPCSTR lpString2,
38 int cchCount2
39 )
40 {
41 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
42 return 0;
43 }
44
45
46 int
47 STDCALL
48 CompareStringW (
49 LCID Locale,
50 DWORD dwCmpFlags,
51 LPCWSTR lpString1,
52 int cchCount1,
53 LPCWSTR lpString2,
54 int cchCount2
55 )
56 {
57 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
58 return 0;
59 }
60
61
62 LCID
63 STDCALL
64 ConvertDefaultLocale (
65 LCID Locale
66 )
67 {
68 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
69 return 0;
70 }
71
72
73 DWORD
74 STDCALL
75 CreateVirtualBuffer (
76 DWORD Unknown0,
77 DWORD Unknown1,
78 DWORD Unknown2
79 )
80 {
81 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
82 return 0;
83 }
84
85
86 WINBOOL
87 STDCALL
88 EnumCalendarInfoW (
89 CALINFO_ENUMPROC lpCalInfoEnumProc,
90 LCID Locale,
91 CALID Calendar,
92 CALTYPE CalType
93 )
94 {
95 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
96 return FALSE;
97 }
98
99
100
101 WINBOOL
102 STDCALL
103 EnumCalendarInfoA (
104 CALINFO_ENUMPROC lpCalInfoEnumProc,
105 LCID Locale,
106 CALID Calendar,
107 CALTYPE CalType
108 )
109 {
110 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
111 return FALSE;
112 }
113
114
115 WINBOOL
116 STDCALL
117 EnumDateFormatsW (
118 DATEFMT_ENUMPROC lpDateFmtEnumProc,
119 LCID Locale,
120 DWORD dwFlags
121 )
122 {
123 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
124 return FALSE;
125 }
126
127
128 WINBOOL
129 STDCALL
130 EnumDateFormatsA (
131 DATEFMT_ENUMPROC lpDateFmtEnumProc,
132 LCID Locale,
133 DWORD dwFlags
134 )
135 {
136 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
137 return FALSE;
138 }
139
140
141
142
143 WINBOOL
144 STDCALL
145 EnumSystemCodePagesW (
146 CODEPAGE_ENUMPROC lpCodePageEnumProc,
147 DWORD dwFlags
148 )
149 {
150 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
151 return FALSE;
152 }
153
154
155 WINBOOL
156 STDCALL
157 EnumSystemCodePagesA (
158 CODEPAGE_ENUMPROC lpCodePageEnumProc,
159 DWORD dwFlags
160 )
161 {
162 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
163 return FALSE;
164 }
165
166
167 WINBOOL
168 STDCALL
169 EnumSystemLocalesW (
170 LOCALE_ENUMPROC lpLocaleEnumProc,
171 DWORD dwFlags
172 )
173 {
174 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
175 return FALSE;
176 }
177
178
179 WINBOOL
180 STDCALL
181 EnumSystemLocalesA (
182 LOCALE_ENUMPROC lpLocaleEnumProc,
183 DWORD dwFlags
184 )
185 {
186 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
187 return FALSE;
188 }
189
190
191 WINBOOL
192 STDCALL
193 EnumTimeFormatsW (
194 TIMEFMT_ENUMPROC lpTimeFmtEnumProc,
195 LCID Locale,
196 DWORD dwFlags
197 )
198 {
199 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
200 return FALSE;
201 }
202
203
204 WINBOOL
205 STDCALL
206 EnumTimeFormatsA (
207 TIMEFMT_ENUMPROC lpTimeFmtEnumProc,
208 LCID Locale,
209 DWORD dwFlags
210 )
211 {
212 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
213 return FALSE;
214 }
215
216
217
218
219
220
221
222 DWORD
223 STDCALL
224 ExitVDM (
225 DWORD Unknown0,
226 DWORD Unknown1
227 )
228 {
229 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
230 return 0;
231 }
232
233
234
235
236 BOOL
237 STDCALL
238 ExtendVirtualBuffer (
239 DWORD Unknown0,
240 DWORD Unknown1
241 )
242 {
243 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
244 return FALSE;
245 }
246
247
248 int
249 STDCALL
250 FoldStringW (
251 DWORD dwMapFlags,
252 LPCWSTR lpSrcStr,
253 int cchSrc,
254 LPWSTR lpDestStr,
255 int cchDest
256 )
257 {
258 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
259 return 0;
260 }
261
262
263 int
264 STDCALL
265 FoldStringA (
266 DWORD dwMapFlags,
267 LPCSTR lpSrcStr,
268 int cchSrc,
269 LPSTR lpDestStr,
270 int cchDest
271 )
272 {
273 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
274 return 0;
275 }
276
277
278 DWORD
279 STDCALL
280 FormatMessageW (
281 DWORD dwFlags,
282 LPCVOID lpSource,
283 DWORD dwMessageId,
284 DWORD dwLanguageId,
285 LPWSTR lpBuffer,
286 DWORD nSize,
287 va_list * Arguments
288 )
289 {
290 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
291 return 0;
292 }
293
294
295 DWORD
296 STDCALL
297 FormatMessageA (
298 DWORD dwFlags,
299 LPCVOID lpSource,
300 DWORD dwMessageId,
301 DWORD dwLanguageId,
302 LPSTR lpBuffer,
303 DWORD nSize,
304 va_list * Arguments
305 )
306 {
307 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
308 return 0;
309 }
310
311
312 BOOL
313 STDCALL
314 FreeVirtualBuffer (
315 HANDLE hVirtualBuffer
316 )
317 {
318 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
319 return FALSE;
320 }
321
322
323 UINT
324 STDCALL
325 GetACP (VOID)
326 {
327 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
328 return 0;
329 }
330
331 WINBOOL
332 STDCALL
333 GetBinaryTypeW (
334 LPCWSTR lpApplicationName,
335 LPDWORD lpBinaryType
336 )
337 {
338 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
339 return FALSE;
340 }
341
342
343 WINBOOL
344 STDCALL
345 GetBinaryTypeA (
346 LPCSTR lpApplicationName,
347 LPDWORD lpBinaryType
348 )
349 {
350 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
351 return FALSE;
352 }
353
354
355 WINBOOL
356 STDCALL
357 GetCPInfo (
358 UINT a0,
359 LPCPINFO a1
360 )
361 {
362 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
363 return 0;
364 }
365
366
367
368
369 WINBOOL
370 STDCALL
371 GetComputerNameW (
372 LPWSTR lpBuffer,
373 LPDWORD nSize
374 )
375 {
376 WCHAR Name [MAX_COMPUTERNAME_LENGTH + 1];
377 DWORD Size = 0;
378
379 /*
380 * FIXME: get the computer's name from
381 * the registry.
382 */
383 lstrcpyW( Name, L"ROSHost" ); /* <-- FIXME -- */
384 Size = lstrlenW(Name) + 1;
385 if (Size > *nSize)
386 {
387 *nSize = Size;
388 SetLastError(ERROR_BUFFER_OVERFLOW);
389 return FALSE;
390 }
391 lstrcpyW( lpBuffer, Name );
392 return TRUE;
393 }
394
395
396 WINBOOL
397 STDCALL
398 GetComputerNameA (
399 LPSTR lpBuffer,
400 LPDWORD nSize
401 )
402 {
403 WCHAR Name [MAX_COMPUTERNAME_LENGTH + 1];
404 int i;
405
406 if (FALSE == GetComputerNameW(
407 Name,
408 nSize
409 ))
410 {
411 return FALSE;
412 }
413 /* FIXME --> */
414 /* Use UNICODE to ANSI */
415 for ( i=0; Name[i]; ++i )
416 {
417 lpBuffer[i] = (CHAR) Name[i];
418 }
419 lpBuffer[i] = '\0';
420 /* FIXME <-- */
421 return TRUE;
422 }
423
424
425
426
427 int
428 STDCALL
429 GetCurrencyFormatW (
430 LCID Locale,
431 DWORD dwFlags,
432 LPCWSTR lpValue,
433 CONST CURRENCYFMT * lpFormat,
434 LPWSTR lpCurrencyStr,
435 int cchCurrency
436 )
437 {
438 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
439 return 0;
440 }
441
442
443 int
444 STDCALL
445 GetCurrencyFormatA (
446 LCID Locale,
447 DWORD dwFlags,
448 LPCSTR lpValue,
449 CONST CURRENCYFMT * lpFormat,
450 LPSTR lpCurrencyStr,
451 int cchCurrency
452 )
453 {
454 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
455 return 0;
456 }
457
458
459
460
461
462 int
463 STDCALL
464 GetDateFormatW (
465 LCID Locale,
466 DWORD dwFlags,
467 CONST SYSTEMTIME * lpDate,
468 LPCWSTR lpFormat,
469 LPWSTR lpDateStr,
470 int cchDate
471 )
472 {
473 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
474 return 0;
475 }
476
477
478 int
479 STDCALL
480 GetDateFormatA (
481 LCID Locale,
482 DWORD dwFlags,
483 CONST SYSTEMTIME * lpDate,
484 LPCSTR lpFormat,
485 LPSTR lpDateStr,
486 int cchDate
487 )
488 {
489 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
490 return 0;
491 }
492
493
494 int
495 STDCALL
496 GetLocaleInfoW (
497 LCID Locale,
498 LCTYPE LCType,
499 LPWSTR lpLCData,
500 int cchData
501 )
502 {
503 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
504 return 0;
505 }
506
507
508 int
509 STDCALL
510 GetLocaleInfoA (
511 LCID Locale,
512 LCTYPE LCType,
513 LPSTR lpLCData,
514 int cchData
515 )
516 {
517 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
518 return 0;
519 }
520
521
522 DWORD
523 STDCALL
524 GetNextVDMCommand (
525 DWORD Unknown0
526 )
527 {
528 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
529 return 0;
530 }
531
532
533 int
534 STDCALL
535 GetNumberFormatW (
536 LCID Locale,
537 DWORD dwFlags,
538 LPCWSTR lpValue,
539 CONST NUMBERFMT * lpFormat,
540 LPWSTR lpNumberStr,
541 int cchNumber
542 )
543 {
544 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
545 return 0;
546 }
547
548
549 int
550 STDCALL
551 GetNumberFormatA (
552 LCID Locale,
553 DWORD dwFlags,
554 LPCSTR lpValue,
555 CONST NUMBERFMT * lpFormat,
556 LPSTR lpNumberStr,
557 int cchNumber
558 )
559 {
560 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
561 return 0;
562 }
563
564
565 UINT
566 STDCALL
567 GetOEMCP (VOID)
568 {
569 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
570 return 437; /* FIXME: call csrss.exe */
571 }
572
573
574 WINBOOL
575 STDCALL
576 GetStringTypeExW (
577 LCID Locale,
578 DWORD dwInfoType,
579 LPCWSTR lpSrcStr,
580 int cchSrc,
581 LPWORD lpCharType
582 )
583 {
584 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
585 return FALSE;
586 }
587
588
589 WINBOOL
590 STDCALL
591 GetStringTypeExA (
592 LCID Locale,
593 DWORD dwInfoType,
594 LPCSTR lpSrcStr,
595 int cchSrc,
596 LPWORD lpCharType
597 )
598 {
599 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
600 return FALSE;
601 }
602
603
604 WINBOOL
605 STDCALL
606 GetStringTypeW (
607 DWORD dwInfoType,
608 LPCWSTR lpSrcStr,
609 int cchSrc,
610 LPWORD lpCharType
611 )
612 {
613 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
614 return FALSE;
615 }
616
617
618 WINBOOL
619 STDCALL
620 GetStringTypeA (
621 LCID Locale,
622 DWORD dwInfoType,
623 LPCSTR lpSrcStr,
624 int cchSrc,
625 LPWORD lpCharType
626 )
627 {
628 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
629 return FALSE;
630 }
631
632
633 LCID
634 STDCALL
635 GetSystemDefaultLCID (VOID)
636 {
637 /* FIXME: ??? */
638 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
639 return MAKELCID(
640 LANG_ENGLISH,
641 SORT_DEFAULT
642 );
643 }
644
645
646 LANGID
647 STDCALL
648 GetSystemDefaultLangID (VOID)
649 {
650 /* FIXME: ??? */
651 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
652 return MAKELANGID(
653 LANG_ENGLISH,
654 SUBLANG_ENGLISH_US
655 );
656 }
657
658
659 DWORD
660 STDCALL
661 GetSystemPowerStatus (
662 DWORD Unknown0
663 )
664 {
665 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
666 return 0;
667 }
668
669
670 LCID
671 STDCALL
672 GetThreadLocale (VOID)
673 {
674 /* FIXME: ??? */
675 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
676 return MAKELCID(
677 LANG_ENGLISH,
678 SORT_DEFAULT
679 );
680 }
681
682 WINBOOL
683 STDCALL
684 GetThreadPriorityBoost (
685 HANDLE hThread,
686 DWORD dwSelector,
687 LPLDT_ENTRY lpSelectorEntry
688 )
689 {
690 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
691 return FALSE;
692 }
693
694 WINBOOL
695 STDCALL
696 GetThreadSelectorEntry (
697 HANDLE hThread,
698 DWORD dwSelector,
699 LPLDT_ENTRY lpSelectorEntry
700 )
701 {
702 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
703 return FALSE;
704 }
705
706
707 int
708 STDCALL
709 GetTimeFormatW (
710 LCID Locale,
711 DWORD dwFlags,
712 CONST SYSTEMTIME * lpTime,
713 LPCWSTR lpFormat,
714 LPWSTR lpTimeStr,
715 int cchTime
716 )
717 {
718 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
719 return 0;
720 }
721
722
723 int
724 STDCALL
725 GetTimeFormatA (
726 LCID Locale,
727 DWORD dwFlags,
728 CONST SYSTEMTIME * lpTime,
729 LPCSTR lpFormat,
730 LPSTR lpTimeStr,
731 int cchTime
732 )
733 {
734 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
735 return 0;
736 }
737
738
739 LCID
740 STDCALL
741 GetUserDefaultLCID (VOID)
742 {
743 /* FIXME: ??? */
744 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
745 return MAKELCID(
746 LANG_ENGLISH,
747 SORT_DEFAULT
748 );
749 }
750
751
752 LANGID
753 STDCALL
754 GetUserDefaultLangID (VOID)
755 {
756 /* FIXME: ??? */
757 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
758 return MAKELANGID(
759 LANG_ENGLISH,
760 SUBLANG_ENGLISH_US
761 );
762 }
763
764
765 DWORD
766 STDCALL
767 GetVDMCurrentDirectories (
768 DWORD Unknown0,
769 DWORD Unknown1
770 )
771 {
772 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
773 return 0;
774 }
775
776
777 WINBOOL
778 STDCALL
779 IsDBCSLeadByte (
780 BYTE TestChar
781 )
782 {
783 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
784 return FALSE;
785 }
786
787
788 WINBOOL
789 STDCALL
790 IsDBCSLeadByteEx (
791 UINT CodePage,
792 BYTE TestChar
793 )
794 {
795 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
796 return FALSE;
797 }
798
799
800 /**********************************************************************
801 * NAME PRIVATE
802 * IsInstalledCP@4
803 *
804 * RETURN VALUE
805 * TRUE if CodePage is installed in the system.
806 */
807 static
808 BOOL
809 STDCALL
810 IsInstalledCP (
811 UINT CodePage
812 )
813 {
814 /* FIXME */
815 return TRUE;
816 }
817
818
819 WINBOOL
820 STDCALL
821 IsValidCodePage (
822 UINT CodePage
823 )
824 {
825 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
826 return FALSE;
827 }
828
829
830 WINBOOL
831 STDCALL
832 IsValidLocale (
833 LCID Locale,
834 DWORD dwFlags
835 )
836 {
837 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
838 return FALSE;
839 }
840
841
842 int
843 STDCALL
844 LCMapStringA (
845 LCID Locale,
846 DWORD dwMapFlags,
847 LPCSTR lpSrcStr,
848 int cchSrc,
849 LPSTR lpDestStr,
850 int cchDest
851 )
852 {
853 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
854 return 0;
855 }
856
857
858 int
859 STDCALL
860 LCMapStringW (
861 LCID Locale,
862 DWORD dwMapFlags,
863 LPCWSTR lpSrcStr,
864 int cchSrc,
865 LPWSTR lpDestStr,
866 int cchDest
867 )
868 {
869 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
870 return 0;
871 }
872
873
874 DWORD
875 STDCALL
876 LoadModule (
877 LPCSTR lpModuleName,
878 LPVOID lpParameterBlock
879 )
880 {
881 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
882 return 0;
883 }
884
885
886 /***********************************************************************
887 * MulDiv (KERNEL32.@)
888 * RETURNS
889 * Result of multiplication and division
890 * -1: Overflow occurred or Divisor was 0
891 */
892
893 //FIXME! move to correct file
894 INT STDCALL MulDiv(
895 INT nMultiplicand,
896 INT nMultiplier,
897 INT nDivisor)
898 {
899 #if SIZEOF_LONG_LONG >= 8
900 long long ret;
901
902 if (!nDivisor) return -1;
903
904 /* We want to deal with a positive divisor to simplify the logic. */
905 if (nDivisor < 0)
906 {
907 nMultiplicand = - nMultiplicand;
908 nDivisor = -nDivisor;
909 }
910
911 /* If the result is positive, we "add" to round. else, we subtract to round. */
912 if ( ( (nMultiplicand < 0) && (nMultiplier < 0) ) ||
913 ( (nMultiplicand >= 0) && (nMultiplier >= 0) ) )
914 ret = (((long long)nMultiplicand * nMultiplier) + (nDivisor/2)) / nDivisor;
915 else
916 ret = (((long long)nMultiplicand * nMultiplier) - (nDivisor/2)) / nDivisor;
917
918 if ((ret > 2147483647) || (ret < -2147483647)) return -1;
919 return ret;
920 #else
921 if (!nDivisor) return -1;
922
923 /* We want to deal with a positive divisor to simplify the logic. */
924 if (nDivisor < 0)
925 {
926 nMultiplicand = - nMultiplicand;
927 nDivisor = -nDivisor;
928 }
929
930 /* If the result is positive, we "add" to round. else, we subtract to round. */
931 if ( ( (nMultiplicand < 0) && (nMultiplier < 0) ) ||
932 ( (nMultiplicand >= 0) && (nMultiplier >= 0) ) )
933 return ((nMultiplicand * nMultiplier) + (nDivisor/2)) / nDivisor;
934
935 return ((nMultiplicand * nMultiplier) - (nDivisor/2)) / nDivisor;
936
937 #endif
938 }
939
940
941 /**********************************************************************
942 * NAME EXPORTED
943 * MultiByteToWideChar@24
944 *
945 * ARGUMENTS
946 * CodePage
947 * CP_ACP ANSI code page
948 * CP_MACCP Macintosh code page
949 * CP_OEMCP OEM code page
950 * (UINT) Any installed code page
951 *
952 * dwFlags
953 * MB_PRECOMPOSED
954 * MB_COMPOSITE
955 * MB_ERR_INVALID_CHARS
956 * MB_USEGLYPHCHARS
957 *
958 * lpMultiByteStr
959 * Input buffer;
960 *
961 * cchMultiByte
962 * Size of MultiByteStr, or -1 if MultiByteStr is
963 * NULL terminated;
964 *
965 * lpWideCharStr
966 * Output buffer;
967 *
968 * cchWideChar
969 * Size (in WCHAR unit) of WideCharStr, or 0
970 * if the caller just wants to know how large
971 * WideCharStr should be for a successful
972 * conversion.
973 *
974 * RETURN VALUE
975 * 0 on error; otherwise the number of WCHAR written
976 * in the WideCharStr buffer.
977 *
978 * NOTE
979 * A raw converter for now. It assumes lpMultiByteStr is
980 * NEVER multi-byte (that is each input character is
981 * 8-bit ASCII) and is ALWAYS NULL terminated.
982 * FIXME-FIXME-FIXME-FIXME
983 */
984 INT
985 STDCALL
986 MultiByteToWideChar (
987 UINT CodePage,
988 DWORD dwFlags,
989 LPCSTR lpMultiByteStr,
990 int cchMultiByte,
991 LPWSTR lpWideCharStr,
992 int cchWideChar
993 )
994 {
995 int InStringLength = 0;
996 BOOL InIsNullTerminated = TRUE;
997 PCHAR r;
998 PWCHAR w;
999 int cchConverted;
1000
1001 /*
1002 * Check the parameters.
1003 */
1004 if ( /* --- CODE PAGE --- */
1005 ( (CP_ACP != CodePage)
1006 && (CP_MACCP != CodePage)
1007 && (CP_OEMCP != CodePage)
1008 && (FALSE == IsInstalledCP (CodePage))
1009 )
1010 /* --- FLAGS --- */
1011 || (dwFlags ^ ( MB_PRECOMPOSED
1012 | MB_COMPOSITE
1013 | MB_ERR_INVALID_CHARS
1014 | MB_USEGLYPHCHARS
1015 )
1016 )
1017 /* --- INPUT BUFFER --- */
1018 || (NULL == lpMultiByteStr)
1019 )
1020 {
1021 SetLastError (ERROR_INVALID_PARAMETER);
1022 return 0;
1023 }
1024 /*
1025 * Compute the input buffer length.
1026 */
1027 if (-1 == cchMultiByte)
1028 {
1029 InStringLength = lstrlen (lpMultiByteStr);
1030 }
1031 else
1032 {
1033 InIsNullTerminated = FALSE;
1034 InStringLength = cchMultiByte;
1035 }
1036 /*
1037 * Does caller query for output
1038 * buffer size?
1039 */
1040 if (0 == cchWideChar)
1041 {
1042 SetLastError (ERROR_SUCCESS);
1043 return InStringLength;
1044 }
1045 /*
1046 * Is space provided for the translated
1047 * string enough?
1048 */
1049 if (cchWideChar < InStringLength)
1050 {
1051 SetLastError (ERROR_INSUFFICIENT_BUFFER);
1052 return 0;
1053 }
1054 /*
1055 * Raw 8- to 16-bit conversion.
1056 */
1057 for ( cchConverted = 0,
1058 r = (PCHAR) lpMultiByteStr,
1059 w = (PWCHAR) lpWideCharStr;
1060
1061 ((*r) && (cchConverted < cchWideChar));
1062
1063 r++,
1064 cchConverted++
1065 )
1066 {
1067 *w = (WCHAR) *r;
1068 }
1069 /*
1070 * Is the input string NULL terminated?
1071 */
1072 if (TRUE == InIsNullTerminated)
1073 {
1074 *w = L'\0';
1075 ++cchConverted;
1076 }
1077 /*
1078 * Return how many characters we
1079 * wrote in the output buffer.
1080 */
1081 SetLastError (ERROR_SUCCESS);
1082 return cchConverted;
1083 }
1084
1085
1086 WINBOOL
1087 STDCALL
1088 QueryPerformanceCounter (
1089 LARGE_INTEGER * lpPerformanceCount
1090 )
1091 {
1092 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1093 return FALSE;
1094 }
1095
1096
1097 WINBOOL
1098 STDCALL
1099 QueryPerformanceFrequency (
1100 LARGE_INTEGER * lpFrequency
1101 )
1102 {
1103 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1104 return FALSE;
1105 }
1106
1107
1108 WINBOOL
1109 STDCALL
1110 RegisterConsoleVDM (
1111 DWORD Unknown0,
1112 DWORD Unknown1,
1113 DWORD Unknown2,
1114 DWORD Unknown3,
1115 DWORD Unknown4,
1116 DWORD Unknown5,
1117 DWORD Unknown6,
1118 DWORD Unknown7,
1119 DWORD Unknown8,
1120 DWORD Unknown9,
1121 DWORD Unknown10
1122 )
1123 {
1124 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1125 return FALSE;
1126 }
1127
1128
1129 WINBOOL
1130 STDCALL
1131 RegisterWowBaseHandlers (
1132 DWORD Unknown0
1133 )
1134 {
1135 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1136 return FALSE;
1137 }
1138
1139
1140 WINBOOL
1141 STDCALL
1142 RegisterWowExec (
1143 DWORD Unknown0
1144 )
1145 {
1146 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1147 return FALSE;
1148 }
1149
1150
1151 WINBOOL
1152 STDCALL
1153 SetComputerNameA (
1154 LPCSTR lpComputerName
1155 )
1156 {
1157 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1158 return FALSE;
1159 }
1160
1161
1162 WINBOOL
1163 STDCALL
1164 SetComputerNameW (
1165 LPCWSTR lpComputerName
1166 )
1167 {
1168 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1169 return FALSE;
1170 }
1171
1172
1173 WINBOOL
1174 STDCALL
1175 SetLocaleInfoA (
1176 LCID Locale,
1177 LCTYPE LCType,
1178 LPCSTR lpLCData
1179 )
1180 {
1181 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1182 return FALSE;
1183 }
1184
1185
1186 WINBOOL
1187 STDCALL
1188 SetLocaleInfoW (
1189 LCID Locale,
1190 LCTYPE LCType,
1191 LPCWSTR lpLCData
1192 )
1193 {
1194 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1195 return FALSE;
1196 }
1197
1198
1199 WINBOOL
1200 STDCALL
1201 SetSystemPowerState (
1202 DWORD Unknown0,
1203 DWORD Unknown1
1204 )
1205 {
1206 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1207 return FALSE;
1208 }
1209
1210 WINBOOL
1211 STDCALL
1212 SetThreadIdealProcessor(VOID)
1213 {
1214 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1215 return 0;
1216 }
1217
1218 WINBOOL
1219 STDCALL
1220 SetThreadLocale (
1221 LCID Locale
1222 )
1223 {
1224 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1225 return FALSE;
1226 }
1227
1228 WINBOOL
1229 STDCALL
1230 SetThreadPriorityBoost(VOID)
1231 {
1232 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1233 return 0;
1234 }
1235
1236 WINBOOL
1237 STDCALL
1238 SetVDMCurrentDirectories (
1239 DWORD Unknown0,
1240 DWORD Unknown1
1241 )
1242 {
1243 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1244 return FALSE;
1245 }
1246
1247
1248 DWORD
1249 STDCALL
1250 TrimVirtualBuffer (
1251 DWORD Unknown0
1252 )
1253 {
1254 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1255 return 0;
1256 }
1257
1258
1259 DWORD
1260 STDCALL
1261 VDMConsoleOperation (
1262 DWORD Unknown0,
1263 DWORD Unknown1
1264 )
1265 {
1266 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1267 return 0;
1268 }
1269
1270
1271 DWORD
1272 STDCALL
1273 VDMOperationStarted (
1274 DWORD Unknown0
1275 )
1276 {
1277 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1278 return 0;
1279 }
1280
1281
1282 DWORD
1283 STDCALL
1284 VerLanguageNameA (
1285 DWORD wLang,
1286 LPSTR szLang,
1287 DWORD nSize
1288 )
1289 {
1290 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1291 return 0;
1292 }
1293
1294
1295 DWORD
1296 STDCALL
1297 VerLanguageNameW (
1298 DWORD wLang,
1299 LPWSTR szLang,
1300 DWORD nSize
1301 )
1302 {
1303 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1304 return 0;
1305 }
1306
1307
1308 DWORD
1309 STDCALL
1310 VirtualBufferExceptionHandler (
1311 DWORD Unknown0,
1312 DWORD Unknown1,
1313 DWORD Unknown2
1314 )
1315 {
1316 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1317 return 0;
1318 }
1319
1320
1321 /**********************************************************************
1322 * NAME EXPORTED
1323 * MultiByteToWideChar@32
1324 *
1325 * Not yet implemented complete (without NLS so far)
1326 *
1327 * ARGUMENTS
1328 * CodePage
1329 * CP_ACP ANSI code page
1330 * CP_MACCP Macintosh code page
1331 * CP_OEMCP OEM code page
1332 * CP_SYMBOL Symbol code page (42)
1333 * CP_THREAD_ACP Current thread's ANSI code page
1334 * CP_UTF7 Translate using UTF-7
1335 * CP_UTF8 Translate using UTF-8
1336 * (UINT) Any installed code page
1337 *
1338 * dwFlags
1339 * WC_NO_BEST_FIT_CHARS
1340 * WC_COMPOSITECHECK Convert composite characters to precomposed characters.
1341 * WC_DISCARDNS Discard nonspacing characters during conversion.
1342 * WC_SEPCHARS Generate separate characters during conversion. This is the default conversion behavior.
1343 * WC_DEFAULTCHAR Replace exceptions with the default character during conversion.
1344 *
1345 * lpWideCharStr
1346 * Points to the wide-character string to be converted.
1347 *
1348 * cchWideChar
1349 * Size (in WCHAR unit) of WideCharStr, or 0
1350 * if the caller just wants to know how large
1351 * WideCharStr should be for a successful
1352 * conversion.
1353 * lpMultiByteStr
1354 * Points to the buffer to receive the translated string.
1355 * cchMultiByte
1356 * Specifies the size in bytes of the buffer pointed to by the
1357 * lpMultiByteStr parameter. If this value is zero, the function
1358 * returns the number of bytes required for the buffer.
1359 * lpDefaultChar
1360 * Points to the character used if a wide character cannot be
1361 * represented in the specified code page. If this parameter is
1362 * NULL, a system default value is used.
1363 FIXME: ignored
1364 * lpUsedDefaultChar
1365 * Points to a flag that indicates whether a default character was used.
1366 * This parameter may be NULL.
1367 FIXME: allways set to FALSE.
1368 *
1369 *
1370 *
1371 * RETURN VALUE
1372 * 0 on error; otherwise the number of bytes written
1373 * in the lpMultiByteStr buffer. Or the number of
1374 * bytes needed for the lpMultiByteStr buffer if cchMultiByte is zero.
1375 *
1376 * NOTE
1377 * A raw converter for now. It just cuts off the upper 9 Bit.
1378 * So the MBCS-string does not contain any LeadCharacters
1379 * FIXME - FIXME - FIXME - FIXME
1380 */
1381
1382 int
1383 STDCALL
1384 WideCharToMultiByte (
1385 UINT CodePage,
1386 DWORD dwFlags,
1387 LPCWSTR lpWideCharStr,
1388 int cchWideChar,
1389 LPSTR lpMultiByteStr,
1390 int cchMultiByte,
1391 LPCSTR lpDefaultChar,
1392 LPBOOL lpUsedDefaultChar
1393 )
1394 {
1395 int wi, di; // wide counter, dbcs byte count
1396
1397 // for now, make no difference but only convert cut the characters to 7Bit
1398 switch( CodePage )
1399 {
1400 case CP_ACP: //ANSI code page
1401 case CP_MACCP: //Macintosh code page
1402 case CP_OEMCP: //OEM code page
1403 case CP_SYMBOL: //Symbol code page (42)
1404 case CP_THREAD_ACP: //ACP Current thread's ANSI code page
1405 case CP_UTF7: //Translate using UTF-7
1406 case CP_UTF8: //Translate using UTF-8
1407 if( cchWideChar == -1 ) // assume its a 0-terminated str
1408 { // and determine its length
1409 for( cchWideChar=0; lpWideCharStr[cchWideChar]!=0; )
1410 cchWideChar++;
1411 }
1412
1413 // user wants to determine needed space
1414 if( cchMultiByte == 0 )
1415 {
1416 SetLastError(ERROR_SUCCESS);
1417 return cchWideChar; // FIXME: determine correct.
1418 }
1419 // the lpWideCharStr is cchWideChar characters long.
1420 for( wi=0, di=0; wi<cchWideChar && di<cchMultiByte; ++wi)
1421 {
1422 // Flag and a not displayable char FIXME
1423 /*if( (dwFlags&WC_NO_BEST_FIT_CHARS) && (lpWideCharStr[wi] >127) )
1424 {
1425 lpMultiByteStr[di]=
1426 *lpUsedDefaultChar = TRUE;
1427
1428 }*/
1429 // FIXME
1430 // just cut off the upper 9 Bit, since vals>=128 mean LeadByte.
1431 lpMultiByteStr[di] = lpWideCharStr[wi] & 0x007F;
1432 ++di;
1433 }
1434 // has MultiByte exceeded but Wide is still in the string?
1435 if( wi < cchWideChar && di >= cchMultiByte)
1436 {
1437 SetLastError(ERROR_INSUFFICIENT_BUFFER);
1438 return di;
1439 }
1440 // else return # of bytes wirtten to MBCSbuffer (di)
1441 SetLastError(ERROR_SUCCESS);
1442 // FIXME: move that elsewhere
1443 if( lpUsedDefaultChar!=NULL ) *lpUsedDefaultChar=FALSE;
1444 return di;
1445 break;
1446 default:
1447 SetLastError(ERROR_INVALID_PARAMETER);
1448 return FALSE;
1449 break;
1450 }
1451 SetLastError(ERROR_INVALID_PARAMETER);
1452 return FALSE;
1453 }
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465 /* EOF */