* added _DISABLE_TIDENTS macro to disable any ANSI/UNICODE ambiguous elements from...
[reactos.git] / reactos / lib / gdi32 / misc / stubsa.c
1 /* $Id: stubsa.c,v 1.23 2003/08/07 04:03:22 royce Exp $
2 *
3 * reactos/lib/gdi32/misc/stubs.c
4 *
5 * GDI32.DLL Stubs for ANSI functions
6 *
7 * When you implement one of these functions,
8 * remove its stub from this file.
9 *
10 */
11 #ifdef UNICODE
12 #undef UNICODE
13 #endif
14
15 #undef WIN32_LEAN_AND_MEAN
16 #include <windows.h>
17 #include <ddk/ntddk.h>
18 #include <win32k/text.h>
19 #include <win32k/metafile.h>
20 #include <win32k/dc.h>
21 #include <rosrtl/devmode.h>
22 #include <rosrtl/logfont.h>
23 #include <internal/heap.h>
24
25 /*
26 * @implemented
27 */
28 int
29 STDCALL
30 AddFontResourceExA ( LPCSTR lpszFilename, DWORD fl, PVOID pvReserved )
31 {
32 NTSTATUS Status;
33 PWSTR FilenameW;
34 int rc = 0;
35
36 Status = HEAP_strdupA2W ( &FilenameW, lpszFilename );
37 if ( !NT_SUCCESS (Status) )
38 SetLastError (RtlNtStatusToDosError(Status));
39 else
40 {
41 rc = AddFontResourceExW ( FilenameW, fl, pvReserved );
42
43 HEAP_free ( &FilenameW );
44 }
45 return rc;
46 }
47
48 /*
49 * @implemented
50 */
51 int
52 STDCALL
53 AddFontResourceA ( LPCSTR lpszFilename )
54 {
55 return AddFontResourceExA ( lpszFilename, 0, 0 );
56 }
57
58
59 /*
60 * @implemented
61 */
62 HMETAFILE
63 STDCALL
64 CopyMetaFileA(
65 HMETAFILE Src,
66 LPCSTR lpszFile
67 )
68 {
69 NTSTATUS Status;
70 PWSTR lpszFileW;
71 HMETAFILE rc = 0;
72
73 Status = HEAP_strdupA2W ( &lpszFileW, lpszFile );
74 if (!NT_SUCCESS (Status))
75 SetLastError (RtlNtStatusToDosError(Status));
76 else
77 {
78 rc = W32kCopyMetaFile ( Src, lpszFileW );
79
80 HEAP_free ( lpszFileW );
81 }
82
83 return rc;
84 }
85
86
87 /*
88 * @implemented
89 */
90 HDC
91 STDCALL
92 CreateICA(
93 LPCSTR lpszDriver,
94 LPCSTR lpszDevice,
95 LPCSTR lpszOutput,
96 CONST DEVMODEA * lpdvmInit
97 )
98 {
99 NTSTATUS Status;
100 LPWSTR lpszDriverW, lpszDeviceW, lpszOutputW;
101 DEVMODEW dvmInitW;
102 HDC rc = 0;
103
104 Status = HEAP_strdupA2W ( &lpszDriverW, lpszDriver );
105 if (!NT_SUCCESS (Status))
106 SetLastError (RtlNtStatusToDosError(Status));
107 else
108 {
109 Status = HEAP_strdupA2W ( &lpszDeviceW, lpszDevice );
110 if (!NT_SUCCESS (Status))
111 SetLastError (RtlNtStatusToDosError(Status));
112 else
113 {
114 Status = HEAP_strdupA2W ( &lpszOutputW, lpszOutput );
115 if (!NT_SUCCESS (Status))
116 SetLastError (RtlNtStatusToDosError(Status));
117 else
118 {
119 if ( lpdvmInit )
120 RosRtlDevModeA2W ( &dvmInitW, (const LPDEVMODEA)lpdvmInit );
121
122 rc = W32kCreateIC ( lpszDriverW,
123 lpszDeviceW,
124 lpszOutputW,
125 lpdvmInit ? &dvmInitW : NULL );
126
127 HEAP_free ( lpszOutputW );
128 }
129 HEAP_free ( lpszDeviceW );
130 }
131 HEAP_free ( lpszDriverW );
132 }
133 return rc;
134 }
135
136
137 /*
138 * @implemented
139 */
140 HDC
141 STDCALL
142 CreateMetaFileA(
143 LPCSTR lpszFile
144 )
145 {
146 NTSTATUS Status;
147 PWSTR lpszFileW;
148 HDC rc = 0;
149
150 Status = HEAP_strdupA2W ( &lpszFileW, lpszFile );
151 if (!NT_SUCCESS (Status))
152 SetLastError (RtlNtStatusToDosError(Status));
153 else
154 {
155 rc = W32kCreateMetaFile ( lpszFileW );
156
157 HEAP_free ( lpszFileW );
158 }
159 return rc;
160 }
161
162
163 /*
164 * @implemented
165 */
166 BOOL
167 STDCALL
168 CreateScalableFontResourceA(
169 DWORD fdwHidden,
170 LPCSTR lpszFontRes,
171 LPCSTR lpszFontFile,
172 LPCSTR lpszCurrentPath
173 )
174 {
175 NTSTATUS Status;
176 LPWSTR lpszFontResW, lpszFontFileW, lpszCurrentPathW;
177 BOOL rc = FALSE;
178
179 Status = HEAP_strdupA2W ( &lpszFontResW, lpszFontRes );
180 if (!NT_SUCCESS (Status))
181 SetLastError (RtlNtStatusToDosError(Status));
182 else
183 {
184 Status = HEAP_strdupA2W ( &lpszFontFileW, lpszFontFile );
185 if (!NT_SUCCESS (Status))
186 SetLastError (RtlNtStatusToDosError(Status));
187 else
188 {
189 Status = HEAP_strdupA2W ( &lpszCurrentPathW, lpszCurrentPath );
190 if (!NT_SUCCESS (Status))
191 SetLastError (RtlNtStatusToDosError(Status));
192 else
193 {
194 rc = W32kCreateScalableFontResource ( fdwHidden,
195 lpszFontResW,
196 lpszFontFileW,
197 lpszCurrentPathW );
198
199 HEAP_free ( lpszCurrentPathW );
200 }
201
202 HEAP_free ( lpszFontFileW );
203 }
204
205 HEAP_free ( lpszFontResW );
206 }
207 return rc;
208 }
209
210
211 /*
212 * @unimplemented
213 */
214 int
215 STDCALL
216 DeviceCapabilitiesExA(
217 LPCSTR pDevice,
218 LPCSTR pPort,
219 WORD fwCapability,
220 LPSTR pOutput,
221 CONST DEVMODEA *pDevMode
222 )
223 {
224 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
225 return 0;
226 }
227
228
229 /*
230 * @unimplemented
231 */
232 int
233 STDCALL
234 EnumFontFamiliesExA (
235 HDC hdc,
236 LPLOGFONTA lpLogFont,
237 FONTENUMEXPROCA lpEnumFontFamProc,
238 LPARAM lParam,
239 DWORD dwFlags
240 )
241 {
242 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
243 return 0;
244 #if 0
245 LOGFONTW LogFontW;
246
247 RosRtlLogFontA2W ( &LogFontW, lpLogFont );
248
249 /* no need to convert LogFontW back to lpLogFont b/c it's an [in] parameter only */
250 return W32kEnumFontFamiliesEx ( hdc, &LogFontW, lpEnumFontFamProc, lParam, dwFlags );
251 #endif
252 }
253
254
255 /*
256 * @unimplemented
257 */
258 int
259 STDCALL
260 EnumFontFamiliesA(
261 HDC hdc,
262 LPCSTR lpszFamily,
263 FONTENUMPROCA lpEnumFontFamProc,
264 LPARAM lParam
265 )
266 {
267 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
268 return 0;
269 #if 0
270 NTSTATUS Status;
271 LPWSTR lpszFamilyW;
272 int rc = 0;
273
274 Status = HEAP_strdupA2W ( &lpszFamilyW, lpszFamily );
275 if (!NT_SUCCESS (Status))
276 SetLastError (RtlNtStatusToDosError(Status));
277 else
278 {
279 rc = W32kEnumFontFamilies ( hdc, lpszFamilyW, lpEnumFontFamProc, lParam );
280
281 HEAP_free ( lpszFamilyW );
282 }
283
284 return rc;
285 #endif
286 }
287
288
289 /*
290 * @implemented
291 */
292 int
293 STDCALL
294 EnumFontsA (
295 HDC hDC,
296 LPCSTR lpFaceName,
297 FONTENUMPROCA FontFunc,
298 LPARAM lParam
299 )
300 {
301 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
302 return 0;
303 #if 0
304 NTSTATUS Status;
305 LPWSTR lpFaceNameW;
306 int rc = 0;
307
308 Status = HEAP_strdupA2W ( &lpFaceNameW, lpFaceName );
309 if (!NT_SUCCESS (Status))
310 SetLastError (RtlNtStatusToDosError(Status));
311 else
312 {
313 rc = W32kEnumFonts ( hDC, lpFaceNameW, FontFunc, lParam );
314
315 HEAP_free ( lpFaceNameW );
316 }
317 return rc;
318 #endif
319 }
320
321
322 /*
323 * @unimplemented
324 */
325 BOOL
326 STDCALL
327 GetCharWidthA (
328 HDC hdc,
329 UINT iFirstChar,
330 UINT iLastChar,
331 LPINT lpBuffer
332 )
333 {
334 /* FIXME what to do with iFirstChar and iLastChar ??? */
335 return W32kGetCharWidth ( hdc, iFirstChar, iLastChar, lpBuffer );
336 }
337
338
339 /*
340 * @unimplemented
341 */
342 BOOL
343 STDCALL
344 GetCharWidth32A(
345 HDC hdc,
346 UINT iFirstChar,
347 UINT iLastChar,
348 LPINT lpBuffer
349 )
350 {
351 /* FIXME what to do with iFirstChar and iLastChar ??? */
352 return W32kGetCharWidth32 ( hdc, iFirstChar, iLastChar, lpBuffer );
353 }
354
355
356 /*
357 * @unimplemented
358 */
359 BOOL
360 APIENTRY
361 GetCharWidthFloatA(
362 HDC hdc,
363 UINT iFirstChar,
364 UINT iLastChar,
365 PFLOAT pxBuffer
366 )
367 {
368 /* FIXME what to do with iFirstChar and iLastChar ??? */
369 return W32kGetCharWidthFloat ( hdc, iFirstChar, iLastChar, pxBuffer );
370 }
371
372
373 /*
374 * @unimplemented
375 */
376 BOOL
377 APIENTRY
378 GetCharABCWidthsA(
379 HDC hdc,
380 UINT uFirstChar,
381 UINT uLastChar,
382 LPABC lpabc
383 )
384 {
385 /* FIXME what to do with uFirstChar and uLastChar ??? */
386 return W32kGetCharABCWidths ( hdc, uFirstChar, uLastChar, lpabc );
387 }
388
389
390 /*
391 * @unimplemented
392 */
393 BOOL
394 APIENTRY
395 GetCharABCWidthsFloatA(
396 HDC hdc,
397 UINT iFirstChar,
398 UINT iLastChar,
399 LPABCFLOAT lpABCF
400 )
401 {
402 /* FIXME what to do with iFirstChar and iLastChar ??? */
403 return W32kGetCharABCWidthsFloat ( hdc, iFirstChar, iLastChar, lpABCF );
404 }
405
406
407 /*
408 * @implemented
409 */
410 DWORD
411 STDCALL
412 GetGlyphOutlineA(
413 HDC hdc,
414 UINT uChar,
415 UINT uFormat,
416 LPGLYPHMETRICS lpgm,
417 DWORD cbBuffer,
418 LPVOID lpvBuffer,
419 CONST MAT2 *lpmat2
420 )
421 {
422 return W32kGetGlyphOutline ( hdc, uChar, uFormat, lpgm, cbBuffer, lpvBuffer, (CONST LPMAT2)lpmat2 );
423 }
424
425
426 /*
427 * @implemented
428 */
429 HMETAFILE
430 STDCALL
431 GetMetaFileA(
432 LPCSTR lpszMetaFile
433 )
434 {
435 NTSTATUS Status;
436 LPWSTR lpszMetaFileW;
437 HMETAFILE rc = 0;
438
439 Status = HEAP_strdupA2W ( &lpszMetaFileW, lpszMetaFile );
440 if (!NT_SUCCESS (Status))
441 SetLastError (RtlNtStatusToDosError(Status));
442 else
443 {
444 rc = W32kGetMetaFile ( lpszMetaFileW );
445
446 HEAP_free ( lpszMetaFileW );
447 }
448
449 return rc;
450 }
451
452
453 /*
454 * @unimplemented
455 */
456 UINT
457 APIENTRY
458 GetOutlineTextMetricsA(
459 HDC hdc,
460 UINT cbData,
461 LPOUTLINETEXTMETRICA lpOTM
462 )
463 {
464 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
465 return 0;
466 }
467
468
469 /*
470 * @implemented
471 */
472 BOOL
473 APIENTRY
474 GetTextExtentExPointA(
475 HDC hdc,
476 LPCSTR lpszStr,
477 int cchString,
478 int nMaxExtent,
479 LPINT lpnFit,
480 LPINT alpDx,
481 LPSIZE lpSize
482 )
483 {
484 NTSTATUS Status;
485 LPWSTR lpszStrW;
486 BOOL rc = 0;
487
488 Status = HEAP_strdupA2W ( &lpszStrW, lpszStr );
489 if (!NT_SUCCESS (Status))
490 SetLastError (RtlNtStatusToDosError(Status));
491 else
492 {
493 rc = W32kGetTextExtentExPoint (
494 hdc, lpszStrW, cchString, nMaxExtent, lpnFit, alpDx, lpSize );
495
496 HEAP_free ( lpszStrW );
497 }
498
499 return rc;
500 }
501
502
503 /*
504 * @unimplemented
505 */
506 DWORD
507 STDCALL
508 GetCharacterPlacementA(
509 HDC hDc,
510 LPCSTR a1,
511 int a2,
512 int a3,
513 LPGCP_RESULTSA a4,
514 DWORD a5
515 )
516 {
517 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
518 return 0;
519 }
520
521
522 /*
523 * @implemented
524 */
525 HDC
526 STDCALL
527 ResetDCA(
528 HDC hdc,
529 CONST DEVMODEA *lpInitData
530 )
531 {
532 DEVMODEW InitDataW;
533
534 RosRtlDevModeA2W ( &InitDataW, (CONST LPDEVMODEA)lpInitData );
535
536 return W32kResetDC ( hdc, &InitDataW );
537 }
538
539
540 /*
541 * @implemented
542 */
543 BOOL
544 STDCALL
545 RemoveFontResourceA(
546 LPCSTR lpFileName
547 )
548 {
549 NTSTATUS Status;
550 LPWSTR lpFileNameW;
551 BOOL rc = 0;
552
553 Status = HEAP_strdupA2W ( &lpFileNameW, lpFileName );
554 if (!NT_SUCCESS (Status))
555 SetLastError (RtlNtStatusToDosError(Status));
556 else
557 {
558 rc = W32kRemoveFontResource ( lpFileNameW );
559
560 HEAP_free ( lpFileNameW );
561 }
562
563 return rc;
564 }
565
566
567 /*
568 * @implemented
569 */
570 HENHMETAFILE
571 STDCALL
572 CopyEnhMetaFileA(
573 HENHMETAFILE hemfSrc,
574 LPCSTR lpszFile
575 )
576 {
577 NTSTATUS Status;
578 LPWSTR lpszFileW;
579 HENHMETAFILE rc = 0;
580
581 Status = HEAP_strdupA2W ( &lpszFileW, lpszFile );
582 if (!NT_SUCCESS (Status))
583 SetLastError (RtlNtStatusToDosError(Status));
584 else
585 {
586 rc = W32kCopyEnhMetaFile ( hemfSrc, lpszFileW );
587
588 HEAP_free ( lpszFileW );
589 }
590 return rc;
591 }
592
593
594 /*
595 * @implemented
596 */
597 HDC
598 STDCALL
599 CreateEnhMetaFileA(
600 HDC hdc,
601 LPCSTR lpFileName,
602 CONST RECT *lpRect,
603 LPCSTR lpDescription
604 )
605 {
606 NTSTATUS Status;
607 LPWSTR lpFileNameW, lpDescriptionW;
608 HDC rc = 0;
609
610 Status = HEAP_strdupA2W ( &lpFileNameW, lpFileName );
611 if (!NT_SUCCESS (Status))
612 SetLastError (RtlNtStatusToDosError(Status));
613 else
614 {
615 Status = HEAP_strdupA2W ( &lpDescriptionW, lpDescription );
616 if (!NT_SUCCESS (Status))
617 SetLastError (RtlNtStatusToDosError(Status));
618 else
619 {
620 rc = W32kCreateEnhMetaFile (
621 hdc, lpFileNameW, (CONST LPRECT)lpRect, lpDescriptionW );
622
623 HEAP_free ( lpDescriptionW );
624 }
625 HEAP_free ( lpFileNameW );
626 }
627
628 return rc;
629 }
630
631
632 /*
633 * @implemented
634 */
635 HENHMETAFILE
636 STDCALL
637 GetEnhMetaFileA(
638 LPCSTR lpszMetaFile
639 )
640 {
641 NTSTATUS Status;
642 LPWSTR lpszMetaFileW;
643 HENHMETAFILE rc = 0;
644
645 Status = HEAP_strdupA2W ( &lpszMetaFileW, lpszMetaFile );
646 if (!NT_SUCCESS (Status))
647 SetLastError (RtlNtStatusToDosError(Status));
648 else
649 {
650 rc = W32kGetEnhMetaFile ( lpszMetaFileW );
651
652 HEAP_free ( lpszMetaFileW );
653 }
654
655 return rc;
656 }
657
658
659 /*
660 * @implemented
661 */
662 UINT
663 STDCALL
664 GetEnhMetaFileDescriptionA(
665 HENHMETAFILE hemf,
666 UINT cchBuffer,
667 LPSTR lpszDescription
668 )
669 {
670 NTSTATUS Status;
671 LPWSTR lpszDescriptionW;
672 UINT rc;
673
674 if ( lpszDescription && cchBuffer )
675 {
676 lpszDescriptionW = (LPWSTR)HEAP_alloc ( cchBuffer*sizeof(WCHAR) );
677 if ( !lpszDescriptionW )
678 {
679 SetLastError (RtlNtStatusToDosError(STATUS_NO_MEMORY));
680 return 0;
681 }
682 }
683 else
684 lpszDescriptionW = NULL;
685
686 rc = W32kGetEnhMetaFileDescription ( hemf, cchBuffer, lpszDescriptionW );
687
688 if ( lpszDescription && cchBuffer )
689 {
690 Status = RtlUnicodeToMultiByteN ( lpszDescription,
691 cchBuffer,
692 NULL,
693 lpszDescriptionW,
694 cchBuffer );
695 HEAP_free ( lpszDescriptionW );
696 if ( !NT_SUCCESS(Status) )
697 {
698 SetLastError (RtlNtStatusToDosError(Status));
699 return 0;
700 }
701 }
702
703 return rc;
704 }
705
706
707 /*
708 * @unimplemented
709 */
710 int
711 STDCALL
712 StartDocA(
713 HDC hdc,
714 CONST DOCINFOA *a1
715 )
716 {
717 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
718 return 0;
719 }
720
721
722 /*
723 * @unimplemented
724 */
725 int
726 STDCALL
727 GetObjectA(
728 HGDIOBJ a0,
729 int a1,
730 LPVOID a2
731 )
732 {
733 return W32kGetObject ( a0, a1, a2 );
734 }
735
736
737 /*
738 * @unimplemented
739 */
740 BOOL
741 STDCALL
742 PolyTextOutA(
743 HDC hdc,
744 CONST POLYTEXTA *a1,
745 int a2
746 )
747 {
748 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
749 return FALSE;
750 }
751
752
753 /*
754 * @unimplemented
755 */
756 int
757 STDCALL
758 GetTextFaceA(
759 HDC a0,
760 int a1,
761 LPSTR a2
762 )
763 {
764 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
765 return FALSE;
766 }
767
768
769 /*
770 * @unimplemented
771 */
772 DWORD
773 STDCALL
774 GetKerningPairsA(
775 HDC a0,
776 DWORD a1,
777 LPKERNINGPAIR a2
778 )
779 {
780 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
781 return 0;
782 }
783
784
785 /*
786 * @unimplemented
787 */
788 BOOL
789 STDCALL
790 GetLogColorSpaceA(
791 HCOLORSPACE a0,
792 LPLOGCOLORSPACEA a1,
793 DWORD a2
794 )
795 {
796 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
797 return FALSE;
798 }
799
800
801 /*
802 * @unimplemented
803 */
804 HCOLORSPACE
805 STDCALL
806 CreateColorSpaceA(
807 LPLOGCOLORSPACEA a0
808 )
809 {
810 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
811 return 0;
812 }
813
814
815 /*
816 * @unimplemented
817 */
818 WINBOOL
819 STDCALL
820 GetICMProfileA(
821 HDC a0,
822 DWORD a1, /* MS says LPDWORD! */
823 LPSTR a2
824 )
825 {
826 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
827 return FALSE;
828 }
829
830
831 /*
832 * @unimplemented
833 */
834 BOOL
835 STDCALL
836 SetICMProfileA(
837 HDC a0,
838 LPSTR a1
839 )
840 {
841 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
842 return FALSE;
843 }
844
845
846 /*
847 * @unimplemented
848 */
849 int
850 STDCALL
851 EnumICMProfilesA(
852 HDC a0,
853 ICMENUMPROCA a1,
854 LPARAM a2
855 )
856 {
857 /*
858 * FIXME - call W32kEnumICMProfiles with NULL for lpstrBuffer
859 * to find out how big a buffer we need. Then allocate that buffer
860 * and call W32kEnumICMProfiles again to have the buffer filled.
861 *
862 * Finally, step through the buffer ( MULTI-SZ recommended for format ),
863 * and convert each string to ANSI, calling the user's callback function
864 * until we run out of strings or the user returns FALSE
865 */
866
867 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
868 return 0;
869 }
870
871
872 /*
873 * @unimplemented
874 */
875 BOOL
876 STDCALL
877 wglUseFontBitmapsA(
878 HDC a0,
879 DWORD a1,
880 DWORD a2,
881 DWORD a3
882 )
883 {
884 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
885 return FALSE;
886 }
887
888
889 /*
890 * @unimplemented
891 */
892 BOOL
893 STDCALL
894 wglUseFontOutlinesA(
895 HDC a0,
896 DWORD a1,
897 DWORD a2,
898 DWORD a3,
899 FLOAT a4,
900 FLOAT a5,
901 int a6,
902 LPGLYPHMETRICSFLOAT a7
903 )
904 {
905 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
906 return FALSE;
907 }
908
909
910 /*
911 * @unimplemented
912 */
913 WINBOOL
914 STDCALL
915 UpdateICMRegKeyA(
916 DWORD a0,
917 DWORD a1,
918 LPSTR a2,
919 UINT a3
920 )
921 {
922 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
923 return FALSE;
924 }
925
926
927 /* EOF */