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