4ecd6c85c4f3a6243001399a9e4b13dcf8213320
[reactos.git] / reactos / lib / kernel32 / misc / stubs.c
1 /* $Id: stubs.c,v 1.32 2002/09/08 10:22:45 chorns 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
683 WINBOOL
684 STDCALL
685 GetThreadSelectorEntry (
686 HANDLE hThread,
687 DWORD dwSelector,
688 LPLDT_ENTRY lpSelectorEntry
689 )
690 {
691 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
692 return FALSE;
693 }
694
695
696 int
697 STDCALL
698 GetTimeFormatW (
699 LCID Locale,
700 DWORD dwFlags,
701 CONST SYSTEMTIME * lpTime,
702 LPCWSTR lpFormat,
703 LPWSTR lpTimeStr,
704 int cchTime
705 )
706 {
707 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
708 return 0;
709 }
710
711
712 int
713 STDCALL
714 GetTimeFormatA (
715 LCID Locale,
716 DWORD dwFlags,
717 CONST SYSTEMTIME * lpTime,
718 LPCSTR lpFormat,
719 LPSTR lpTimeStr,
720 int cchTime
721 )
722 {
723 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
724 return 0;
725 }
726
727
728 LCID
729 STDCALL
730 GetUserDefaultLCID (VOID)
731 {
732 /* FIXME: ??? */
733 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
734 return MAKELCID(
735 LANG_ENGLISH,
736 SORT_DEFAULT
737 );
738 }
739
740
741 LANGID
742 STDCALL
743 GetUserDefaultLangID (VOID)
744 {
745 /* FIXME: ??? */
746 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
747 return MAKELANGID(
748 LANG_ENGLISH,
749 SUBLANG_ENGLISH_US
750 );
751 }
752
753
754 DWORD
755 STDCALL
756 GetVDMCurrentDirectories (
757 DWORD Unknown0,
758 DWORD Unknown1
759 )
760 {
761 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
762 return 0;
763 }
764
765
766 WINBOOL
767 STDCALL
768 IsDBCSLeadByte (
769 BYTE TestChar
770 )
771 {
772 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
773 return FALSE;
774 }
775
776
777 WINBOOL
778 STDCALL
779 IsDBCSLeadByteEx (
780 UINT CodePage,
781 BYTE TestChar
782 )
783 {
784 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
785 return FALSE;
786 }
787
788
789 /**********************************************************************
790 * NAME PRIVATE
791 * IsInstalledCP@4
792 *
793 * RETURN VALUE
794 * TRUE if CodePage is installed in the system.
795 */
796 static
797 BOOL
798 STDCALL
799 IsInstalledCP (
800 UINT CodePage
801 )
802 {
803 /* FIXME */
804 return TRUE;
805 }
806
807
808 WINBOOL
809 STDCALL
810 IsValidCodePage (
811 UINT CodePage
812 )
813 {
814 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
815 return FALSE;
816 }
817
818
819 WINBOOL
820 STDCALL
821 IsValidLocale (
822 LCID Locale,
823 DWORD dwFlags
824 )
825 {
826 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
827 return FALSE;
828 }
829
830
831 int
832 STDCALL
833 LCMapStringA (
834 LCID Locale,
835 DWORD dwMapFlags,
836 LPCSTR lpSrcStr,
837 int cchSrc,
838 LPSTR lpDestStr,
839 int cchDest
840 )
841 {
842 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
843 return 0;
844 }
845
846
847 int
848 STDCALL
849 LCMapStringW (
850 LCID Locale,
851 DWORD dwMapFlags,
852 LPCWSTR lpSrcStr,
853 int cchSrc,
854 LPWSTR lpDestStr,
855 int cchDest
856 )
857 {
858 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
859 return 0;
860 }
861
862
863 DWORD
864 STDCALL
865 LoadModule (
866 LPCSTR lpModuleName,
867 LPVOID lpParameterBlock
868 )
869 {
870 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
871 return 0;
872 }
873
874
875 /***********************************************************************
876 * MulDiv (KERNEL32.@)
877 * RETURNS
878 * Result of multiplication and division
879 * -1: Overflow occurred or Divisor was 0
880 */
881
882 //FIXME! move to correct file
883 INT STDCALL MulDiv(
884 INT nMultiplicand,
885 INT nMultiplier,
886 INT nDivisor)
887 {
888 #if SIZEOF_LONG_LONG >= 8
889 long long ret;
890
891 if (!nDivisor) return -1;
892
893 /* We want to deal with a positive divisor to simplify the logic. */
894 if (nDivisor < 0)
895 {
896 nMultiplicand = - nMultiplicand;
897 nDivisor = -nDivisor;
898 }
899
900 /* If the result is positive, we "add" to round. else, we subtract to round. */
901 if ( ( (nMultiplicand < 0) && (nMultiplier < 0) ) ||
902 ( (nMultiplicand >= 0) && (nMultiplier >= 0) ) )
903 ret = (((long long)nMultiplicand * nMultiplier) + (nDivisor/2)) / nDivisor;
904 else
905 ret = (((long long)nMultiplicand * nMultiplier) - (nDivisor/2)) / nDivisor;
906
907 if ((ret > 2147483647) || (ret < -2147483647)) return -1;
908 return ret;
909 #else
910 if (!nDivisor) return -1;
911
912 /* We want to deal with a positive divisor to simplify the logic. */
913 if (nDivisor < 0)
914 {
915 nMultiplicand = - nMultiplicand;
916 nDivisor = -nDivisor;
917 }
918
919 /* If the result is positive, we "add" to round. else, we subtract to round. */
920 if ( ( (nMultiplicand < 0) && (nMultiplier < 0) ) ||
921 ( (nMultiplicand >= 0) && (nMultiplier >= 0) ) )
922 return ((nMultiplicand * nMultiplier) + (nDivisor/2)) / nDivisor;
923
924 return ((nMultiplicand * nMultiplier) - (nDivisor/2)) / nDivisor;
925
926 #endif
927 }
928
929
930 /**********************************************************************
931 * NAME EXPORTED
932 * MultiByteToWideChar@24
933 *
934 * ARGUMENTS
935 * CodePage
936 * CP_ACP ANSI code page
937 * CP_MACCP Macintosh code page
938 * CP_OEMCP OEM code page
939 * (UINT) Any installed code page
940 *
941 * dwFlags
942 * MB_PRECOMPOSED
943 * MB_COMPOSITE
944 * MB_ERR_INVALID_CHARS
945 * MB_USEGLYPHCHARS
946 *
947 * lpMultiByteStr
948 * Input buffer;
949 *
950 * cchMultiByte
951 * Size of MultiByteStr, or -1 if MultiByteStr is
952 * NULL terminated;
953 *
954 * lpWideCharStr
955 * Output buffer;
956 *
957 * cchWideChar
958 * Size (in WCHAR unit) of WideCharStr, or 0
959 * if the caller just wants to know how large
960 * WideCharStr should be for a successful
961 * conversion.
962 *
963 * RETURN VALUE
964 * 0 on error; otherwise the number of WCHAR written
965 * in the WideCharStr buffer.
966 *
967 * NOTE
968 * A raw converter for now. It assumes lpMultiByteStr is
969 * NEVER multi-byte (that is each input character is
970 * 8-bit ASCII) and is ALWAYS NULL terminated.
971 * FIXME-FIXME-FIXME-FIXME
972 */
973 INT
974 STDCALL
975 MultiByteToWideChar (
976 UINT CodePage,
977 DWORD dwFlags,
978 LPCSTR lpMultiByteStr,
979 int cchMultiByte,
980 LPWSTR lpWideCharStr,
981 int cchWideChar
982 )
983 {
984 int InStringLength = 0;
985 BOOL InIsNullTerminated = TRUE;
986 PCHAR r;
987 PWCHAR w;
988 int cchConverted;
989
990 /*
991 * Check the parameters.
992 */
993 if ( /* --- CODE PAGE --- */
994 ( (CP_ACP != CodePage)
995 && (CP_MACCP != CodePage)
996 && (CP_OEMCP != CodePage)
997 && (FALSE == IsInstalledCP (CodePage))
998 )
999 /* --- FLAGS --- */
1000 || (dwFlags ^ ( MB_PRECOMPOSED
1001 | MB_COMPOSITE
1002 | MB_ERR_INVALID_CHARS
1003 | MB_USEGLYPHCHARS
1004 )
1005 )
1006 /* --- INPUT BUFFER --- */
1007 || (NULL == lpMultiByteStr)
1008 )
1009 {
1010 SetLastError (ERROR_INVALID_PARAMETER);
1011 return 0;
1012 }
1013 /*
1014 * Compute the input buffer length.
1015 */
1016 if (-1 == cchMultiByte)
1017 {
1018 InStringLength = lstrlen (lpMultiByteStr);
1019 }
1020 else
1021 {
1022 InIsNullTerminated = FALSE;
1023 InStringLength = cchMultiByte;
1024 }
1025 /*
1026 * Does caller query for output
1027 * buffer size?
1028 */
1029 if (0 == cchWideChar)
1030 {
1031 SetLastError (ERROR_SUCCESS);
1032 return InStringLength;
1033 }
1034 /*
1035 * Is space provided for the translated
1036 * string enough?
1037 */
1038 if (cchWideChar < InStringLength)
1039 {
1040 SetLastError (ERROR_INSUFFICIENT_BUFFER);
1041 return 0;
1042 }
1043 /*
1044 * Raw 8- to 16-bit conversion.
1045 */
1046 for ( cchConverted = 0,
1047 r = (PCHAR) lpMultiByteStr,
1048 w = (PWCHAR) lpWideCharStr;
1049
1050 ((*r) && (cchConverted < cchWideChar));
1051
1052 r++,
1053 cchConverted++
1054 )
1055 {
1056 *w = (WCHAR) *r;
1057 }
1058 /*
1059 * Is the input string NULL terminated?
1060 */
1061 if (TRUE == InIsNullTerminated)
1062 {
1063 *w = L'\0';
1064 ++cchConverted;
1065 }
1066 /*
1067 * Return how many characters we
1068 * wrote in the output buffer.
1069 */
1070 SetLastError (ERROR_SUCCESS);
1071 return cchConverted;
1072 }
1073
1074
1075 WINBOOL
1076 STDCALL
1077 QueryPerformanceCounter (
1078 LARGE_INTEGER * lpPerformanceCount
1079 )
1080 {
1081 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1082 return FALSE;
1083 }
1084
1085
1086 WINBOOL
1087 STDCALL
1088 QueryPerformanceFrequency (
1089 LARGE_INTEGER * lpFrequency
1090 )
1091 {
1092 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1093 return FALSE;
1094 }
1095
1096
1097 WINBOOL
1098 STDCALL
1099 RegisterConsoleVDM (
1100 DWORD Unknown0,
1101 DWORD Unknown1,
1102 DWORD Unknown2,
1103 DWORD Unknown3,
1104 DWORD Unknown4,
1105 DWORD Unknown5,
1106 DWORD Unknown6,
1107 DWORD Unknown7,
1108 DWORD Unknown8,
1109 DWORD Unknown9,
1110 DWORD Unknown10
1111 )
1112 {
1113 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1114 return FALSE;
1115 }
1116
1117
1118 WINBOOL
1119 STDCALL
1120 RegisterWowBaseHandlers (
1121 DWORD Unknown0
1122 )
1123 {
1124 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1125 return FALSE;
1126 }
1127
1128
1129 WINBOOL
1130 STDCALL
1131 RegisterWowExec (
1132 DWORD Unknown0
1133 )
1134 {
1135 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1136 return FALSE;
1137 }
1138
1139
1140 WINBOOL
1141 STDCALL
1142 SetComputerNameA (
1143 LPCSTR lpComputerName
1144 )
1145 {
1146 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1147 return FALSE;
1148 }
1149
1150
1151 WINBOOL
1152 STDCALL
1153 SetComputerNameW (
1154 LPCWSTR lpComputerName
1155 )
1156 {
1157 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1158 return FALSE;
1159 }
1160
1161
1162 WINBOOL
1163 STDCALL
1164 SetLocaleInfoA (
1165 LCID Locale,
1166 LCTYPE LCType,
1167 LPCSTR lpLCData
1168 )
1169 {
1170 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1171 return FALSE;
1172 }
1173
1174
1175 WINBOOL
1176 STDCALL
1177 SetLocaleInfoW (
1178 LCID Locale,
1179 LCTYPE LCType,
1180 LPCWSTR lpLCData
1181 )
1182 {
1183 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1184 return FALSE;
1185 }
1186
1187
1188 WINBOOL
1189 STDCALL
1190 SetSystemPowerState (
1191 DWORD Unknown0,
1192 DWORD Unknown1
1193 )
1194 {
1195 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1196 return FALSE;
1197 }
1198
1199
1200 WINBOOL
1201 STDCALL
1202 SetThreadLocale (
1203 LCID Locale
1204 )
1205 {
1206 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1207 return FALSE;
1208 }
1209
1210
1211 WINBOOL
1212 STDCALL
1213 SetVDMCurrentDirectories (
1214 DWORD Unknown0,
1215 DWORD Unknown1
1216 )
1217 {
1218 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1219 return FALSE;
1220 }
1221
1222
1223 DWORD
1224 STDCALL
1225 TrimVirtualBuffer (
1226 DWORD Unknown0
1227 )
1228 {
1229 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1230 return 0;
1231 }
1232
1233
1234 DWORD
1235 STDCALL
1236 VDMConsoleOperation (
1237 DWORD Unknown0,
1238 DWORD Unknown1
1239 )
1240 {
1241 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1242 return 0;
1243 }
1244
1245
1246 DWORD
1247 STDCALL
1248 VDMOperationStarted (
1249 DWORD Unknown0
1250 )
1251 {
1252 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1253 return 0;
1254 }
1255
1256
1257 DWORD
1258 STDCALL
1259 VerLanguageNameA (
1260 DWORD wLang,
1261 LPSTR szLang,
1262 DWORD nSize
1263 )
1264 {
1265 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1266 return 0;
1267 }
1268
1269
1270 DWORD
1271 STDCALL
1272 VerLanguageNameW (
1273 DWORD wLang,
1274 LPWSTR szLang,
1275 DWORD nSize
1276 )
1277 {
1278 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1279 return 0;
1280 }
1281
1282
1283 DWORD
1284 STDCALL
1285 VirtualBufferExceptionHandler (
1286 DWORD Unknown0,
1287 DWORD Unknown1,
1288 DWORD Unknown2
1289 )
1290 {
1291 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1292 return 0;
1293 }
1294
1295
1296 /**********************************************************************
1297 * NAME EXPORTED
1298 * MultiByteToWideChar@32
1299 *
1300 * Not yet implemented complete (without NLS so far)
1301 *
1302 * ARGUMENTS
1303 * CodePage
1304 * CP_ACP ANSI code page
1305 * CP_MACCP Macintosh code page
1306 * CP_OEMCP OEM code page
1307 * CP_SYMBOL Symbol code page (42)
1308 * CP_THREAD_ACP Current thread's ANSI code page
1309 * CP_UTF7 Translate using UTF-7
1310 * CP_UTF8 Translate using UTF-8
1311 * (UINT) Any installed code page
1312 *
1313 * dwFlags
1314 * WC_NO_BEST_FIT_CHARS
1315 * WC_COMPOSITECHECK Convert composite characters to precomposed characters.
1316 * WC_DISCARDNS Discard nonspacing characters during conversion.
1317 * WC_SEPCHARS Generate separate characters during conversion. This is the default conversion behavior.
1318 * WC_DEFAULTCHAR Replace exceptions with the default character during conversion.
1319 *
1320 * lpWideCharStr
1321 * Points to the wide-character string to be converted.
1322 *
1323 * cchWideChar
1324 * Size (in WCHAR unit) of WideCharStr, or 0
1325 * if the caller just wants to know how large
1326 * WideCharStr should be for a successful
1327 * conversion.
1328 * lpMultiByteStr
1329 * Points to the buffer to receive the translated string.
1330 * cchMultiByte
1331 * Specifies the size in bytes of the buffer pointed to by the
1332 * lpMultiByteStr parameter. If this value is zero, the function
1333 * returns the number of bytes required for the buffer.
1334 * lpDefaultChar
1335 * Points to the character used if a wide character cannot be
1336 * represented in the specified code page. If this parameter is
1337 * NULL, a system default value is used.
1338 FIXME: ignored
1339 * lpUsedDefaultChar
1340 * Points to a flag that indicates whether a default character was used.
1341 * This parameter may be NULL.
1342 FIXME: allways set to FALSE.
1343 *
1344 *
1345 *
1346 * RETURN VALUE
1347 * 0 on error; otherwise the number of bytes written
1348 * in the lpMultiByteStr buffer. Or the number of
1349 * bytes needed for the lpMultiByteStr buffer if cchMultiByte is zero.
1350 *
1351 * NOTE
1352 * A raw converter for now. It just cuts off the upper 9 Bit.
1353 * So the MBCS-string does not contain any LeadCharacters
1354 * FIXME - FIXME - FIXME - FIXME
1355 */
1356
1357 int
1358 STDCALL
1359 WideCharToMultiByte (
1360 UINT CodePage,
1361 DWORD dwFlags,
1362 LPCWSTR lpWideCharStr,
1363 int cchWideChar,
1364 LPSTR lpMultiByteStr,
1365 int cchMultiByte,
1366 LPCSTR lpDefaultChar,
1367 LPBOOL lpUsedDefaultChar
1368 )
1369 {
1370 int wi, di; // wide counter, dbcs byte count
1371
1372 // for now, make no difference but only convert cut the characters to 7Bit
1373 switch( CodePage )
1374 {
1375 case CP_ACP: //ANSI code page
1376 case CP_MACCP: //Macintosh code page
1377 case CP_OEMCP: //OEM code page
1378 case CP_SYMBOL: //Symbol code page (42)
1379 case CP_THREAD_ACP: //ACP Current thread's ANSI code page
1380 case CP_UTF7: //Translate using UTF-7
1381 case CP_UTF8: //Translate using UTF-8
1382 if( cchWideChar == -1 ) // assume its a 0-terminated str
1383 { // and determine its length
1384 for( cchWideChar=0; lpWideCharStr[cchWideChar]!=0; )
1385 cchWideChar++;
1386 }
1387
1388 // user wants to determine needed space
1389 if( cchMultiByte == 0 )
1390 {
1391 SetLastError(ERROR_SUCCESS);
1392 return cchWideChar; // FIXME: determine correct.
1393 }
1394 // the lpWideCharStr is cchWideChar characters long.
1395 for( wi=0, di=0; wi<cchWideChar && di<cchMultiByte; ++wi)
1396 {
1397 // Flag and a not displayable char FIXME
1398 /*if( (dwFlags&WC_NO_BEST_FIT_CHARS) && (lpWideCharStr[wi] >127) )
1399 {
1400 lpMultiByteStr[di]=
1401 *lpUsedDefaultChar = TRUE;
1402
1403 }*/
1404 // FIXME
1405 // just cut off the upper 9 Bit, since vals>=128 mean LeadByte.
1406 lpMultiByteStr[di] = lpWideCharStr[wi] & 0x007F;
1407 ++di;
1408 }
1409 // has MultiByte exceeded but Wide is still in the string?
1410 if( wi < cchWideChar && di >= cchMultiByte)
1411 {
1412 SetLastError(ERROR_INSUFFICIENT_BUFFER);
1413 return di;
1414 }
1415 // else return # of bytes wirtten to MBCSbuffer (di)
1416 SetLastError(ERROR_SUCCESS);
1417 // FIXME: move that elsewhere
1418 if( lpUsedDefaultChar!=NULL ) *lpUsedDefaultChar=FALSE;
1419 return di;
1420 break;
1421 default:
1422 SetLastError(ERROR_INVALID_PARAMETER);
1423 return FALSE;
1424 break;
1425 }
1426 SetLastError(ERROR_INVALID_PARAMETER);
1427 return FALSE;
1428 }
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440 /* EOF */