Fill some structs more correctly.
[reactos.git] / reactos / lib / ddraw / main.c
1
2 /* $Id$
3 *
4 * COPYRIGHT: See COPYING in the top level directory
5 * PROJECT: ReactOS kernel
6 * FILE: lib/ddraw/ddraw.c
7 * PURPOSE: DirectDraw Library
8 * PROGRAMMER: Magnus Olsen (greatlrd)
9 *
10 */
11
12 #include <windows.h>
13 #include "rosdraw.h"
14
15
16 HRESULT WINAPI Create_DirectDraw (LPGUID pGUID, LPDIRECTDRAW* pIface, REFIID id, BOOL ex)
17 {
18 IDirectDrawImpl* This = (IDirectDrawImpl*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectDrawImpl));
19
20 if (This == NULL)
21 return E_OUTOFMEMORY;
22
23 ZeroMemory(This,sizeof(IDirectDrawImpl));
24
25 This->lpVtbl = &DirectDraw7_Vtable;
26 This->lpVtbl_v1 = &DDRAW_IDirectDraw_VTable;
27 This->lpVtbl_v2 = &DDRAW_IDirectDraw2_VTable;
28 This->lpVtbl_v4 = &DDRAW_IDirectDraw4_VTable;
29
30 This->DirectDrawGlobal.dwRefCnt = 1;
31 *pIface = (LPDIRECTDRAW)This;
32
33 if(This->lpVtbl->QueryInterface ((LPDIRECTDRAW7)This, id, (void**)&pIface) != S_OK)
34 return DDERR_INVALIDPARAMS;
35
36 return This->lpVtbl->Initialize ((LPDIRECTDRAW7)This, pGUID);
37 }
38
39 HRESULT WINAPI DirectDrawCreate (LPGUID lpGUID, LPDIRECTDRAW* lplpDD, LPUNKNOWN pUnkOuter)
40 {
41 /* check see if pUnkOuter is null or not */
42 if (pUnkOuter)
43 {
44 /* we do not use same error code as MS, ms use 0x8004110 */
45 return DDERR_INVALIDPARAMS;
46 }
47
48 return Create_DirectDraw (lpGUID, lplpDD, &IID_IDirectDraw, FALSE);
49 }
50
51 HRESULT WINAPI DirectDrawCreateEx(LPGUID lpGUID, LPVOID* lplpDD, REFIID id, LPUNKNOWN pUnkOuter)
52 {
53 /* check see if pUnkOuter is null or not */
54 if (pUnkOuter)
55 {
56 /* we do not use same error code as MS, ms use 0x8004110 */
57 return DDERR_INVALIDPARAMS;
58 }
59
60 /* Is it a DirectDraw 7 Request or not */
61 if (!IsEqualGUID(id, &IID_IDirectDraw7))
62 {
63 return DDERR_INVALIDPARAMS;
64 }
65
66 return Create_DirectDraw (lpGUID, (LPDIRECTDRAW*)lplpDD, id, TRUE);
67 }
68
69 HRESULT WINAPI DirectDrawEnumerateA(
70 LPDDENUMCALLBACKA lpCallback,
71 LPVOID lpContext
72 )
73 {
74 DX_STUB;
75 }
76
77
78 HRESULT WINAPI DirectDrawEnumerateW(
79 LPDDENUMCALLBACKW lpCallback,
80 LPVOID lpContext
81 )
82 {
83 DX_STUB;
84 }
85
86 HRESULT WINAPI DirectDrawEnumerateExA(
87 LPDDENUMCALLBACKEXA lpCallback,
88 LPVOID lpContext,
89 DWORD dwFlags
90 )
91 {
92 DX_STUB;
93 }
94
95 HRESULT WINAPI DirectDrawEnumerateExW(
96 LPDDENUMCALLBACKEXW lpCallback,
97 LPVOID lpContext,
98 DWORD dwFlags
99 )
100 {
101 DX_STUB;
102 }
103