moved metafile functions into objects/metafile.c
[reactos.git] / reactos / lib / gdi32 / misc / stubsa.c
1 /* $Id: stubsa.c,v 1.25 2003/11/15 15:18:06 weiden 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/dc.h>
20 #include <rosrtl/devmode.h>
21 #include <rosrtl/logfont.h>
22 #include <internal/heap.h>
23
24 /*
25 * @implemented
26 */
27 int
28 STDCALL
29 AddFontResourceExA ( LPCSTR lpszFilename, DWORD fl, PVOID pvReserved )
30 {
31 NTSTATUS Status;
32 PWSTR FilenameW;
33 int rc = 0;
34
35 Status = HEAP_strdupA2W ( &FilenameW, lpszFilename );
36 if ( !NT_SUCCESS (Status) )
37 SetLastError (RtlNtStatusToDosError(Status));
38 else
39 {
40 rc = AddFontResourceExW ( FilenameW, fl, pvReserved );
41
42 HEAP_free ( &FilenameW );
43 }
44 return rc;
45 }
46
47 /*
48 * @implemented
49 */
50 int
51 STDCALL
52 AddFontResourceA ( LPCSTR lpszFilename )
53 {
54 return AddFontResourceExA ( lpszFilename, 0, 0 );
55 }
56
57
58 /*
59 * @implemented
60 */
61 HDC
62 STDCALL
63 CreateICA(
64 LPCSTR lpszDriver,
65 LPCSTR lpszDevice,
66 LPCSTR lpszOutput,
67 CONST DEVMODEA * lpdvmInit
68 )
69 {
70 NTSTATUS Status;
71 LPWSTR lpszDriverW, lpszDeviceW, lpszOutputW;
72 DEVMODEW dvmInitW;
73 HDC rc = 0;
74
75 Status = HEAP_strdupA2W ( &lpszDriverW, lpszDriver );
76 if (!NT_SUCCESS (Status))
77 SetLastError (RtlNtStatusToDosError(Status));
78 else
79 {
80 Status = HEAP_strdupA2W ( &lpszDeviceW, lpszDevice );
81 if (!NT_SUCCESS (Status))
82 SetLastError (RtlNtStatusToDosError(Status));
83 else
84 {
85 Status = HEAP_strdupA2W ( &lpszOutputW, lpszOutput );
86 if (!NT_SUCCESS (Status))
87 SetLastError (RtlNtStatusToDosError(Status));
88 else
89 {
90 if ( lpdvmInit )
91 RosRtlDevModeA2W ( &dvmInitW, (const LPDEVMODEA)lpdvmInit );
92
93 rc = NtGdiCreateIC ( lpszDriverW,
94 lpszDeviceW,
95 lpszOutputW,
96 lpdvmInit ? &dvmInitW : NULL );
97
98 HEAP_free ( lpszOutputW );
99 }
100 HEAP_free ( lpszDeviceW );
101 }
102 HEAP_free ( lpszDriverW );
103 }
104 return rc;
105 }
106
107
108 /*
109 * @implemented
110 */
111 BOOL
112 STDCALL
113 CreateScalableFontResourceA(
114 DWORD fdwHidden,
115 LPCSTR lpszFontRes,
116 LPCSTR lpszFontFile,
117 LPCSTR lpszCurrentPath
118 )
119 {
120 NTSTATUS Status;
121 LPWSTR lpszFontResW, lpszFontFileW, lpszCurrentPathW;
122 BOOL rc = FALSE;
123
124 Status = HEAP_strdupA2W ( &lpszFontResW, lpszFontRes );
125 if (!NT_SUCCESS (Status))
126 SetLastError (RtlNtStatusToDosError(Status));
127 else
128 {
129 Status = HEAP_strdupA2W ( &lpszFontFileW, lpszFontFile );
130 if (!NT_SUCCESS (Status))
131 SetLastError (RtlNtStatusToDosError(Status));
132 else
133 {
134 Status = HEAP_strdupA2W ( &lpszCurrentPathW, lpszCurrentPath );
135 if (!NT_SUCCESS (Status))
136 SetLastError (RtlNtStatusToDosError(Status));
137 else
138 {
139 rc = NtGdiCreateScalableFontResource ( fdwHidden,
140 lpszFontResW,
141 lpszFontFileW,
142 lpszCurrentPathW );
143
144 HEAP_free ( lpszCurrentPathW );
145 }
146
147 HEAP_free ( lpszFontFileW );
148 }
149
150 HEAP_free ( lpszFontResW );
151 }
152 return rc;
153 }
154
155
156 /*
157 * @unimplemented
158 */
159 int
160 STDCALL
161 DeviceCapabilitiesExA(
162 LPCSTR pDevice,
163 LPCSTR pPort,
164 WORD fwCapability,
165 LPSTR pOutput,
166 CONST DEVMODEA *pDevMode
167 )
168 {
169 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
170 return 0;
171 }
172
173
174 /*
175 * @unimplemented
176 */
177 int
178 STDCALL
179 EnumFontFamiliesExA (
180 HDC hdc,
181 LPLOGFONTA lpLogFont,
182 FONTENUMEXPROCA lpEnumFontFamProc,
183 LPARAM lParam,
184 DWORD dwFlags
185 )
186 {
187 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
188 return 0;
189 #if 0
190 LOGFONTW LogFontW;
191
192 RosRtlLogFontA2W ( &LogFontW, lpLogFont );
193
194 /* no need to convert LogFontW back to lpLogFont b/c it's an [in] parameter only */
195 return NtGdiEnumFontFamiliesEx ( hdc, &LogFontW, lpEnumFontFamProc, lParam, dwFlags );
196 #endif
197 }
198
199
200 /*
201 * @unimplemented
202 */
203 int
204 STDCALL
205 EnumFontFamiliesA(
206 HDC hdc,
207 LPCSTR lpszFamily,
208 FONTENUMPROCA lpEnumFontFamProc,
209 LPARAM lParam
210 )
211 {
212 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
213 return 0;
214 #if 0
215 NTSTATUS Status;
216 LPWSTR lpszFamilyW;
217 int rc = 0;
218
219 Status = HEAP_strdupA2W ( &lpszFamilyW, lpszFamily );
220 if (!NT_SUCCESS (Status))
221 SetLastError (RtlNtStatusToDosError(Status));
222 else
223 {
224 rc = NtGdiEnumFontFamilies ( hdc, lpszFamilyW, lpEnumFontFamProc, lParam );
225
226 HEAP_free ( lpszFamilyW );
227 }
228
229 return rc;
230 #endif
231 }
232
233
234 /*
235 * @implemented
236 */
237 int
238 STDCALL
239 EnumFontsA (
240 HDC hDC,
241 LPCSTR lpFaceName,
242 FONTENUMPROCA FontFunc,
243 LPARAM lParam
244 )
245 {
246 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
247 return 0;
248 #if 0
249 NTSTATUS Status;
250 LPWSTR lpFaceNameW;
251 int rc = 0;
252
253 Status = HEAP_strdupA2W ( &lpFaceNameW, lpFaceName );
254 if (!NT_SUCCESS (Status))
255 SetLastError (RtlNtStatusToDosError(Status));
256 else
257 {
258 rc = NtGdiEnumFonts ( hDC, lpFaceNameW, FontFunc, lParam );
259
260 HEAP_free ( lpFaceNameW );
261 }
262 return rc;
263 #endif
264 }
265
266
267 /*
268 * @unimplemented
269 */
270 BOOL
271 STDCALL
272 GetCharWidthA (
273 HDC hdc,
274 UINT iFirstChar,
275 UINT iLastChar,
276 LPINT lpBuffer
277 )
278 {
279 /* FIXME what to do with iFirstChar and iLastChar ??? */
280 return NtGdiGetCharWidth ( hdc, iFirstChar, iLastChar, lpBuffer );
281 }
282
283
284 /*
285 * @unimplemented
286 */
287 BOOL
288 STDCALL
289 GetCharWidth32A(
290 HDC hdc,
291 UINT iFirstChar,
292 UINT iLastChar,
293 LPINT lpBuffer
294 )
295 {
296 /* FIXME what to do with iFirstChar and iLastChar ??? */
297 return NtGdiGetCharWidth32 ( hdc, iFirstChar, iLastChar, lpBuffer );
298 }
299
300
301 /*
302 * @unimplemented
303 */
304 BOOL
305 APIENTRY
306 GetCharWidthFloatA(
307 HDC hdc,
308 UINT iFirstChar,
309 UINT iLastChar,
310 PFLOAT pxBuffer
311 )
312 {
313 /* FIXME what to do with iFirstChar and iLastChar ??? */
314 return NtGdiGetCharWidthFloat ( hdc, iFirstChar, iLastChar, pxBuffer );
315 }
316
317
318 /*
319 * @unimplemented
320 */
321 BOOL
322 APIENTRY
323 GetCharABCWidthsA(
324 HDC hdc,
325 UINT uFirstChar,
326 UINT uLastChar,
327 LPABC lpabc
328 )
329 {
330 /* FIXME what to do with uFirstChar and uLastChar ??? */
331 return NtGdiGetCharABCWidths ( hdc, uFirstChar, uLastChar, lpabc );
332 }
333
334
335 /*
336 * @unimplemented
337 */
338 BOOL
339 APIENTRY
340 GetCharABCWidthsFloatA(
341 HDC hdc,
342 UINT iFirstChar,
343 UINT iLastChar,
344 LPABCFLOAT lpABCF
345 )
346 {
347 /* FIXME what to do with iFirstChar and iLastChar ??? */
348 return NtGdiGetCharABCWidthsFloat ( hdc, iFirstChar, iLastChar, lpABCF );
349 }
350
351
352 /*
353 * @implemented
354 */
355 DWORD
356 STDCALL
357 GetGlyphOutlineA(
358 HDC hdc,
359 UINT uChar,
360 UINT uFormat,
361 LPGLYPHMETRICS lpgm,
362 DWORD cbBuffer,
363 LPVOID lpvBuffer,
364 CONST MAT2 *lpmat2
365 )
366 {
367 return NtGdiGetGlyphOutline ( hdc, uChar, uFormat, lpgm, cbBuffer, lpvBuffer, (CONST LPMAT2)lpmat2 );
368 }
369
370
371 /*
372 * @unimplemented
373 */
374 UINT
375 APIENTRY
376 GetOutlineTextMetricsA(
377 HDC hdc,
378 UINT cbData,
379 LPOUTLINETEXTMETRICA lpOTM
380 )
381 {
382 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
383 return 0;
384 }
385
386
387 /*
388 * @implemented
389 */
390 BOOL
391 APIENTRY
392 GetTextExtentExPointA(
393 HDC hdc,
394 LPCSTR lpszStr,
395 int cchString,
396 int nMaxExtent,
397 LPINT lpnFit,
398 LPINT alpDx,
399 LPSIZE lpSize
400 )
401 {
402 NTSTATUS Status;
403 LPWSTR lpszStrW;
404 BOOL rc = 0;
405
406 Status = HEAP_strdupA2W ( &lpszStrW, lpszStr );
407 if (!NT_SUCCESS (Status))
408 SetLastError (RtlNtStatusToDosError(Status));
409 else
410 {
411 rc = NtGdiGetTextExtentExPoint (
412 hdc, lpszStrW, cchString, nMaxExtent, lpnFit, alpDx, lpSize );
413
414 HEAP_free ( lpszStrW );
415 }
416
417 return rc;
418 }
419
420
421 /*
422 * @unimplemented
423 */
424 DWORD
425 STDCALL
426 GetCharacterPlacementA(
427 HDC hDc,
428 LPCSTR a1,
429 int a2,
430 int a3,
431 LPGCP_RESULTSA a4,
432 DWORD a5
433 )
434 {
435 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
436 return 0;
437 }
438
439
440 /*
441 * @implemented
442 */
443 HDC
444 STDCALL
445 ResetDCA(
446 HDC hdc,
447 CONST DEVMODEA *lpInitData
448 )
449 {
450 DEVMODEW InitDataW;
451
452 RosRtlDevModeA2W ( &InitDataW, (CONST LPDEVMODEA)lpInitData );
453
454 return NtGdiResetDC ( hdc, &InitDataW );
455 }
456
457
458 /*
459 * @implemented
460 */
461 BOOL
462 STDCALL
463 RemoveFontResourceA(
464 LPCSTR lpFileName
465 )
466 {
467 NTSTATUS Status;
468 LPWSTR lpFileNameW;
469 BOOL rc = 0;
470
471 Status = HEAP_strdupA2W ( &lpFileNameW, lpFileName );
472 if (!NT_SUCCESS (Status))
473 SetLastError (RtlNtStatusToDosError(Status));
474 else
475 {
476 rc = NtGdiRemoveFontResource ( lpFileNameW );
477
478 HEAP_free ( lpFileNameW );
479 }
480
481 return rc;
482 }
483
484
485 /*
486 * @unimplemented
487 */
488 int
489 STDCALL
490 StartDocA(
491 HDC hdc,
492 CONST DOCINFOA *a1
493 )
494 {
495 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
496 return 0;
497 }
498
499
500 /*
501 * @unimplemented
502 */
503 int
504 STDCALL
505 GetObjectA(
506 HGDIOBJ a0,
507 int a1,
508 LPVOID a2
509 )
510 {
511 return NtGdiGetObject ( a0, a1, a2 );
512 }
513
514
515 /*
516 * @unimplemented
517 */
518 BOOL
519 STDCALL
520 PolyTextOutA(
521 HDC hdc,
522 CONST POLYTEXTA *a1,
523 int a2
524 )
525 {
526 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
527 return FALSE;
528 }
529
530
531 /*
532 * @unimplemented
533 */
534 int
535 STDCALL
536 GetTextFaceA(
537 HDC a0,
538 int a1,
539 LPSTR a2
540 )
541 {
542 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
543 return FALSE;
544 }
545
546
547 /*
548 * @unimplemented
549 */
550 DWORD
551 STDCALL
552 GetKerningPairsA(
553 HDC a0,
554 DWORD a1,
555 LPKERNINGPAIR a2
556 )
557 {
558 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
559 return 0;
560 }
561
562
563 /*
564 * @unimplemented
565 */
566 BOOL
567 STDCALL
568 GetLogColorSpaceA(
569 HCOLORSPACE a0,
570 LPLOGCOLORSPACEA a1,
571 DWORD a2
572 )
573 {
574 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
575 return FALSE;
576 }
577
578
579 /*
580 * @unimplemented
581 */
582 HCOLORSPACE
583 STDCALL
584 CreateColorSpaceA(
585 LPLOGCOLORSPACEA a0
586 )
587 {
588 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
589 return 0;
590 }
591
592
593 /*
594 * @unimplemented
595 */
596 WINBOOL
597 STDCALL
598 GetICMProfileA(
599 HDC a0,
600 DWORD a1, /* MS says LPDWORD! */
601 LPSTR a2
602 )
603 {
604 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
605 return FALSE;
606 }
607
608
609 /*
610 * @unimplemented
611 */
612 BOOL
613 STDCALL
614 SetICMProfileA(
615 HDC a0,
616 LPSTR a1
617 )
618 {
619 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
620 return FALSE;
621 }
622
623
624 /*
625 * @unimplemented
626 */
627 int
628 STDCALL
629 EnumICMProfilesA(
630 HDC a0,
631 ICMENUMPROCA a1,
632 LPARAM a2
633 )
634 {
635 /*
636 * FIXME - call NtGdiEnumICMProfiles with NULL for lpstrBuffer
637 * to find out how big a buffer we need. Then allocate that buffer
638 * and call NtGdiEnumICMProfiles again to have the buffer filled.
639 *
640 * Finally, step through the buffer ( MULTI-SZ recommended for format ),
641 * and convert each string to ANSI, calling the user's callback function
642 * until we run out of strings or the user returns FALSE
643 */
644
645 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
646 return 0;
647 }
648
649
650 /*
651 * @unimplemented
652 */
653 BOOL
654 STDCALL
655 wglUseFontBitmapsA(
656 HDC a0,
657 DWORD a1,
658 DWORD a2,
659 DWORD a3
660 )
661 {
662 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
663 return FALSE;
664 }
665
666
667 /*
668 * @unimplemented
669 */
670 BOOL
671 STDCALL
672 wglUseFontOutlinesA(
673 HDC a0,
674 DWORD a1,
675 DWORD a2,
676 DWORD a3,
677 FLOAT a4,
678 FLOAT a5,
679 int a6,
680 LPGLYPHMETRICSFLOAT a7
681 )
682 {
683 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
684 return FALSE;
685 }
686
687
688 /*
689 * @unimplemented
690 */
691 WINBOOL
692 STDCALL
693 UpdateICMRegKeyA(
694 DWORD a0,
695 DWORD a1,
696 LPSTR a2,
697 UINT a3
698 )
699 {
700 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
701 return FALSE;
702 }
703
704
705 /* EOF */