Author: gbrunmar
Date: Tue Aug 19 10:42:23 2008
New Revision: 35452
URL:
http://svn.reactos.org/svn/reactos?rev=35452&view=rev
Log:
* Removed d3d9's dependency on the missing strsafe library
* Replaced .def file with a .spec file
Added:
trunk/reactos/dll/directx/d3d9/d3d9.spec (with props)
Removed:
trunk/reactos/dll/directx/d3d9/d3d9.def
Modified:
trunk/reactos/dll/directx/d3d9/adapter.c
trunk/reactos/dll/directx/d3d9/d3d9.c
trunk/reactos/dll/directx/d3d9/d3d9.rbuild
trunk/reactos/dll/directx/d3d9/d3d9_caps.c
trunk/reactos/dll/directx/d3d9/d3d9_create.c
trunk/reactos/dll/directx/d3d9/d3d9_helpers.c
trunk/reactos/dll/directx/d3d9/d3d9_helpers.h
trunk/reactos/dll/directx/d3d9/format.c
trunk/reactos/include/psdk/d3d9types.h
Modified: trunk/reactos/dll/directx/d3d9/adapter.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/d3d9/adapter.c…
==============================================================================
--- trunk/reactos/dll/directx/d3d9/adapter.c [iso-8859-1] (original)
+++ trunk/reactos/dll/directx/d3d9/adapter.c [iso-8859-1] Tue Aug 19 10:42:23 2008
@@ -10,10 +10,10 @@
#include "d3d9_common.h"
#include <d3d9.h>
#include <ddraw.h>
-#include <strsafe.h>
#include <debug.h>
#include <d3dhal.h>
#include "d3d9_private.h"
+#include "d3d9_helpers.h"
#include "adapter.h"
#define D3D9_CAPS1 (D3DCAPS_READ_SCANLINE)
@@ -58,7 +58,7 @@
if (ERROR_SUCCESS == RegQueryValueExA(hKey, "InstalledDisplayDrivers",
0, &Type, (LPBYTE)pIdentifier->Driver, &DriverNameLength))
{
pIdentifier->Driver[DriverNameLength] = '\0';
- StringCbCatA(pIdentifier->Driver, MAX_DEVICE_IDENTIFIER_STRING,
".dll");
+ SafeAppendString(pIdentifier->Driver, MAX_DEVICE_IDENTIFIER_STRING,
".dll");
bResult = TRUE;
}
Modified: trunk/reactos/dll/directx/d3d9/d3d9.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/d3d9/d3d9.c?re…
==============================================================================
--- trunk/reactos/dll/directx/d3d9/d3d9.c [iso-8859-1] (original)
+++ trunk/reactos/dll/directx/d3d9/d3d9.c [iso-8859-1] Tue Aug 19 10:42:23 2008
@@ -11,7 +11,6 @@
#include "d3d9_helpers.h"
#include "d3d9_create.h"
#include <debug.h>
-#include <strsafe.h>
#define DEBUG_MESSAGE_BUFFER_SIZE 512
@@ -25,31 +24,31 @@
"Recompile the application against the appropriate SDK for the installed
runtime.\n"
"\n";
-HRESULT Direct3DShaderValidatorCreate9(void)
+HRESULT WINAPI Direct3DShaderValidatorCreate9(void)
{
UNIMPLEMENTED
return 0;
}
-HRESULT PSGPError(void)
+HRESULT WINAPI PSGPError(void)
{
UNIMPLEMENTED
return 0;
}
-HRESULT PSGPSampleTexture(void)
+HRESULT WINAPI PSGPSampleTexture(void)
{
UNIMPLEMENTED
return 0;
}
-HRESULT DebugSetLevel(void)
+HRESULT WINAPI DebugSetLevel(void)
{
UNIMPLEMENTED
return 0;
}
-HRESULT DebugSetMute(DWORD dw1)
+HRESULT WINAPI DebugSetMute(DWORD dw1)
{
UNIMPLEMENTED
return 0;
@@ -86,7 +85,7 @@
if (SDKVersion & DX_D3D9_DEBUG)
{
HRESULT hResult;
- hResult = StringCbPrintfA(DebugMessageBuffer, DEBUG_MESSAGE_BUFFER_SIZE,
D3dError_WrongSdkVersion, NoDebugSDKVersion, D3D_SDK_VERSION);
+ hResult = SafeFormatString(DebugMessageBuffer, DEBUG_MESSAGE_BUFFER_SIZE,
D3dError_WrongSdkVersion, NoDebugSDKVersion, D3D_SDK_VERSION);
if (SUCCEEDED(hResult))
OutputDebugStringA(DebugMessageBuffer);
}
Removed: trunk/reactos/dll/directx/d3d9/d3d9.def
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/d3d9/d3d9.def?…
==============================================================================
--- trunk/reactos/dll/directx/d3d9/d3d9.def [iso-8859-1] (original)
+++ trunk/reactos/dll/directx/d3d9/d3d9.def (removed)
@@ -1,8 +1,0 @@
-LIBRARY d3d9
-EXPORTS
- Direct3DShaderValidatorCreate9
- PSGPError
- PSGPSampleTexture
- DebugSetLevel
- DebugSetMute
- Direct3DCreate9
Modified: trunk/reactos/dll/directx/d3d9/d3d9.rbuild
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/d3d9/d3d9.rbui…
==============================================================================
--- trunk/reactos/dll/directx/d3d9/d3d9.rbuild [iso-8859-1] (original)
+++ trunk/reactos/dll/directx/d3d9/d3d9.rbuild [iso-8859-1] Tue Aug 19 10:42:23 2008
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
<module name="d3d9" type="win32dll" entrypoint="0"
installbase="system32" installname="d3d9.dll"
baseaddress="0x4fdd0000">
- <importlibrary definition="d3d9.def" />
+ <importlibrary definition="d3d9.spec.def" />
<library>advapi32</library>
<library>kernel32</library>
@@ -9,7 +9,6 @@
<library>gdi32</library>
<library>uuid</library>
<library>dxguid</library>
- <library>strsafe</library>
<library>version</library>
<library>d3d8thk</library>
@@ -22,4 +21,5 @@
<file>adapter.c</file>
<file>format.c</file>
<file>d3d9.rc</file>
+ <file>d3d9.spec</file>
</module>
Added: trunk/reactos/dll/directx/d3d9/d3d9.spec
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/d3d9/d3d9.spec…
==============================================================================
--- trunk/reactos/dll/directx/d3d9/d3d9.spec (added)
+++ trunk/reactos/dll/directx/d3d9/d3d9.spec [iso-8859-1] Tue Aug 19 10:42:23 2008
@@ -1,0 +1,6 @@
+@ stdcall Direct3DShaderValidatorCreate9()
+@ stdcall PSGPError()
+@ stdcall PSGPSampleTexture()
+@ stdcall DebugSetLevel()
+@ stdcall DebugSetMute(long)
+@ stdcall Direct3DCreate9(long)
Propchange: trunk/reactos/dll/directx/d3d9/d3d9.spec
------------------------------------------------------------------------------
svn:eol-style = native
Modified: trunk/reactos/dll/directx/d3d9/d3d9_caps.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/d3d9/d3d9_caps…
==============================================================================
--- trunk/reactos/dll/directx/d3d9/d3d9_caps.c [iso-8859-1] (original)
+++ trunk/reactos/dll/directx/d3d9/d3d9_caps.c [iso-8859-1] Tue Aug 19 10:42:23 2008
@@ -7,7 +7,6 @@
#include <ddrawgdi.h>
#include <dll/directx/d3d8thk.h>
#include <debug.h>
-#include <strsafe.h>
#include <limits.h>
#include "d3d9_helpers.h"
#include "d3d9_caps.h"
@@ -98,7 +97,7 @@
}
- StringCbCopyA(pUnknown6BC->szDeviceName, CCHDEVICENAME, lpszDeviceName);
+ SafeCopyString(pUnknown6BC->szDeviceName, CCHDEVICENAME, lpszDeviceName);
//pUnknown6BC->DeviceUniq = DdQueryDisplaySettingsUniqueness();
pUnknown6BC->DeviceType = DeviceType;
Modified: trunk/reactos/dll/directx/d3d9/d3d9_create.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/d3d9/d3d9_crea…
==============================================================================
--- trunk/reactos/dll/directx/d3d9/d3d9_create.c [iso-8859-1] (original)
+++ trunk/reactos/dll/directx/d3d9/d3d9_create.c [iso-8859-1] Tue Aug 19 10:42:23 2008
@@ -13,7 +13,6 @@
#include <debug.h>
#include <ddrawi.h>
#include <ddrawgdi.h>
-#include <strsafe.h>
static const GUID DISPLAY_GUID = { 0x67685559, 0x3106, 0x11D0, { 0xB9, 0x71, 0x00, 0xAA,
0x00, 0x34, 0x2F, 0x9F } };
Modified: trunk/reactos/dll/directx/d3d9/d3d9_helpers.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/d3d9/d3d9_help…
==============================================================================
--- trunk/reactos/dll/directx/d3d9/d3d9_helpers.c [iso-8859-1] (original)
+++ trunk/reactos/dll/directx/d3d9/d3d9_helpers.c [iso-8859-1] Tue Aug 19 10:42:23 2008
@@ -36,6 +36,59 @@
return FALSE;
return TRUE;
+}
+
+HRESULT SafeFormatString(OUT LPSTR Buffer, IN LONG BufferSize, IN LPCSTR FormatString,
... )
+{
+ DWORD BytesWritten;
+ va_list vargs;
+
+ if (BufferSize == 0)
+ return DDERR_INVALIDPARAMS;
+
+ va_start(vargs, FormatString);
+ BytesWritten = _vsnprintf(Buffer, BufferSize-1, FormatString, vargs);
+
+ if (BytesWritten < BufferSize)
+ return DDERR_GENERIC;
+
+ Buffer[BufferSize-1] = '\0';
+
+ return ERROR_SUCCESS;
+}
+
+HRESULT SafeCopyString(OUT LPSTR Dst, IN DWORD DstSize, IN LPCSTR Src)
+{
+ HRESULT hr = ERROR_SUCCESS;
+
+ if (Dst == NULL || DstSize == 0 || Src == NULL)
+ return DDERR_INVALIDPARAMS;
+
+ while (*Src != '\0' && DstSize > 0)
+ {
+ *Dst++ = *Src++;
+ --DstSize;
+ }
+
+ if (DstSize == 0)
+ {
+ --Dst;
+ hr = DDERR_GENERIC;
+ }
+
+ return hr;
+}
+
+HRESULT SafeAppendString(IN OUT LPSTR Dst, IN DWORD DstSize, IN LPCSTR Src)
+{
+ DWORD CurrentDstLength;
+
+ if (Dst == NULL || DstSize == 0)
+ return DDERR_INVALIDPARAMS;
+
+ CurrentDstLength = strlen(Dst);
+
+ return SafeCopyString(Dst + CurrentDstLength, DstSize - CurrentDstLength, Src);
}
HRESULT AlignedAlloc(IN OUT LPVOID *ppObject, IN SIZE_T dwSize)
Modified: trunk/reactos/dll/directx/d3d9/d3d9_helpers.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/d3d9/d3d9_help…
==============================================================================
--- trunk/reactos/dll/directx/d3d9/d3d9_helpers.h [iso-8859-1] (original)
+++ trunk/reactos/dll/directx/d3d9/d3d9_helpers.h [iso-8859-1] Tue Aug 19 10:42:23 2008
@@ -15,6 +15,11 @@
/* Reads a registry value if it's of the correct value type */
BOOL ReadRegistryValue(IN DWORD ValueType, IN LPCSTR ValueName, OUT LPBYTE DataBuffer, IN
OUT LPDWORD DataBufferSize);
+/* Safe string formatting */
+HRESULT SafeFormatString(IN OUT LPSTR Buffer, IN LONG BufferSize, IN LPCSTR FormatString,
... );
+HRESULT SafeCopyString(OUT LPSTR Dst, IN DWORD DstSize, IN LPCSTR Src);
+HRESULT SafeAppendString(IN OUT LPSTR Dst, IN DWORD DstSize, IN LPCSTR Src);
+
/* Allocates memory and returns an aligned pointer */
HRESULT AlignedAlloc(IN OUT LPVOID *ppObject, IN SIZE_T dwSize);
Modified: trunk/reactos/dll/directx/d3d9/format.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/d3d9/format.c?…
==============================================================================
--- trunk/reactos/dll/directx/d3d9/format.c [iso-8859-1] (original)
+++ trunk/reactos/dll/directx/d3d9/format.c [iso-8859-1] Tue Aug 19 10:42:23 2008
@@ -9,6 +9,7 @@
#include "format.h"
#include <ddrawi.h>
#include <debug.h>
+#include <d3d9types.h>
BOOL IsBackBufferFormat(D3DFORMAT Format)
{
Modified: trunk/reactos/include/psdk/d3d9types.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/d3d9types.h?r…
==============================================================================
--- trunk/reactos/include/psdk/d3d9types.h [iso-8859-1] (original)
+++ trunk/reactos/include/psdk/d3d9types.h [iso-8859-1] Tue Aug 19 10:42:23 2008
@@ -822,6 +822,11 @@
D3DFMT_L16 = 81,
D3DFMT_D32F_LOCKABLE = 82,
D3DFMT_D24FS8 = 83,
+
+#ifndef D3D_DISABLE_9EX
+ D3DFMT_D32_LOCKABLE = 84,
+ D3DFMT_S8_LOCKABLE = 85,
+#endif
D3DFMT_VERTEXDATA = 100,
D3DFMT_INDEX16 = 101,