From 30a07e90469f6cc4a2cefbbf9ebdc25d97c7fe30 Mon Sep 17 00:00:00 2001
From: Francois Gouget <fgouget@free.fr>
Date: Wed, 20 Apr 2005 18:42:04 +0000
Subject: [PATCH] Fix the DCICreatePrimary() prototype. It's supposed to return
 an int so have it return DCI_FAIL_UNSUPPORTED. Add the needed error codes and
 the DCISURFACEINFO definition to dciddi.h. Add dciman.h and put the function
 prototypes there. dciddi.h and dciman.h should be installed with the other
 Windows headers.

---
 dlls/dciman32/dciman_main.c |  9 +++++----
 include/Makefile.in         |  2 ++
 include/dciddi.h            | 26 ++++++++++++++++++++++++-
 include/dciman.h            | 38 +++++++++++++++++++++++++++++++++++++
 tools/winapi/win32.api      |  5 +++++
 5 files changed, 75 insertions(+), 5 deletions(-)
 create mode 100644 include/dciman.h

diff --git a/dlls/dciman32/dciman_main.c b/dlls/dciman32/dciman_main.c
index f625ddaaacf..8a690b6f742 100644
--- a/dlls/dciman32/dciman_main.c
+++ b/dlls/dciman32/dciman_main.c
@@ -25,6 +25,7 @@
 #include "windef.h"
 #include "winbase.h"
 #include "winerror.h"
+#include "dciman.h"
 #include "wine/debug.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(dciman);
@@ -47,7 +48,7 @@ BOOL WINAPI DllMain( HINSTANCE inst, DWORD reason, LPVOID reserved )
 HDC WINAPI
 DCIOpenProvider(void) {
     SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-    return 0;
+    return NULL;
 }
 
 /***********************************************************************
@@ -62,10 +63,10 @@ DCICloseProvider(HDC hdc) {
 /**************************************************************************
  *                 DCICreatePrimary (DCIMAN32.@)
  */
-void WINAPI 
-DCICreatePrimary(HDC hdc, LPVOID pDciSurfaceInfo)
+int WINAPI 
+DCICreatePrimary(HDC hdc, LPDCISURFACEINFO *pDciSurfaceInfo)
 {
     SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
     FIXME("%p %p\n", hdc, pDciSurfaceInfo);
-    return;
+    return DCI_FAIL_UNSUPPORTED;
 }
diff --git a/include/Makefile.in b/include/Makefile.in
index 11e7bd09b50..59e997eb8e4 100644
--- a/include/Makefile.in
+++ b/include/Makefile.in
@@ -76,6 +76,8 @@ WINDOWS_INCLUDES = \
 	d3dx8core.h \
 	dbghelp.h \
 	dbt.h \
+	dciddi.h \
+	dciman.h \
 	dde.h \
 	ddeml.h \
 	ddraw.h \
diff --git a/include/dciddi.h b/include/dciddi.h
index c5708e26880..54b5521ef8d 100644
--- a/include/dciddi.h
+++ b/include/dciddi.h
@@ -36,7 +36,11 @@ extern "C" {
 #define DCIESCAPE			5
 
 /* DCI Errors */
-#define DCI_OK		0
+#define DCI_OK		                0
+#define DCI_FAIL_GENERIC               -1
+#define DCI_FAIL_UNSUPPORTEDVERSION    -2
+#define DCI_FAIL_INVALIDSURFACE        -3
+#define DCI_FAIL_UNSUPPORTED           -4
 
 
 typedef int DCIRVAL; /* DCI callback return type */
@@ -52,6 +56,26 @@ typedef struct _DCICMD {
     DWORD dwReserved;
 } DCICMD,*LPDCICMD;
 
+typedef struct _DCISURFACEINFO {
+    DWORD dwSize;
+    DWORD dwDCICaps;
+    DWORD dwCompression;
+    DWORD dwMask[3];
+    DWORD dwWidth;
+    DWORD dwHeight;
+    LONG  lStride;
+    DWORD dwBitCount;
+    ULONG_PTR dwOffSurface;
+    WORD  wSelSurface;
+    WORD  wReserved;
+    DWORD dwReserved1;
+    DWORD dwReserved2;
+    DWORD dwReserved3;
+    DCIRVAL (CALLBACK *BeginAccess)(LPVOID, LPRECT);
+    void (CALLBACK *EndAccess)(LPVOID);
+    void (CALLBACK *DestroySurface)(LPVOID);
+} DCISURFACEINFO, *LPDCISURFACEINFO;
+
 #ifdef __cplusplus
 } /* extern "C" */
 #endif
diff --git a/include/dciman.h b/include/dciman.h
new file mode 100644
index 00000000000..7f5d11ef843
--- /dev/null
+++ b/include/dciman.h
@@ -0,0 +1,38 @@
+/*
+ * DCI driver interface
+ *
+ * Copyright (C) 2005 Francois Gouget
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#ifndef _INC_DCIMAN
+#define _INC_DCIMAN
+
+#include <dciddi.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+HDC         WINAPI DCIOpenProvider(void);
+void        WINAPI DCICloseProvider(HDC);
+int         WINAPI DCICreatePrimary(HDC,LPDCISURFACEINFO*);
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /* _INC_DCIMAN */
diff --git a/tools/winapi/win32.api b/tools/winapi/win32.api
index a71d06d9780..c84fec74790 100644
--- a/tools/winapi/win32.api
+++ b/tools/winapi/win32.api
@@ -708,6 +708,11 @@ PSTR
 %long
 
 HDC
+int
+
+%ptr
+
+LPDCISURFACEINFO *
 
 %void
 
-- 
GitLab