mirror of
https://github.com/reactos/reactos.git
synced 2025-03-30 17:10:22 +00:00
* Removed d3d9's dependency on the missing strsafe library
* Replaced .def file with a .spec file svn path=/trunk/; revision=35452
This commit is contained in:
parent
19ce17e295
commit
9df926c8e0
11 changed files with 81 additions and 22 deletions
|
@ -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 @@ static BOOL GetDriverName(LPDISPLAY_DEVICEA pDisplayDevice, D3DADAPTER_IDENTIFIE
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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 @@ static LPCSTR D3dError_WrongSdkVersion =
|
|||
"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 @@ IDirect3D9* WINAPI Direct3DCreate9(UINT SDKVersion)
|
|||
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);
|
||||
}
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
LIBRARY d3d9
|
||||
EXPORTS
|
||||
Direct3DShaderValidatorCreate9
|
||||
PSGPError
|
||||
PSGPSampleTexture
|
||||
DebugSetLevel
|
||||
DebugSetMute
|
||||
Direct3DCreate9
|
|
@ -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>
|
||||
|
|
6
reactos/dll/directx/d3d9/d3d9.spec
Normal file
6
reactos/dll/directx/d3d9/d3d9.spec
Normal file
|
@ -0,0 +1,6 @@
|
|||
@ stdcall Direct3DShaderValidatorCreate9()
|
||||
@ stdcall PSGPError()
|
||||
@ stdcall PSGPSampleTexture()
|
||||
@ stdcall DebugSetLevel()
|
||||
@ stdcall DebugSetMute(long)
|
||||
@ stdcall Direct3DCreate9(long)
|
|
@ -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 @@ static void CreateInternalDeviceData(HDC hDC, LPCSTR lpszDeviceName, D3D9_Unknow
|
|||
}
|
||||
|
||||
|
||||
StringCbCopyA(pUnknown6BC->szDeviceName, CCHDEVICENAME, lpszDeviceName);
|
||||
SafeCopyString(pUnknown6BC->szDeviceName, CCHDEVICENAME, lpszDeviceName);
|
||||
//pUnknown6BC->DeviceUniq = DdQueryDisplaySettingsUniqueness();
|
||||
pUnknown6BC->DeviceType = DeviceType;
|
||||
|
||||
|
|
|
@ -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 } };
|
||||
|
||||
|
|
|
@ -38,6 +38,59 @@ BOOL ReadRegistryValue(IN DWORD ValueType, IN LPCSTR ValueName, OUT LPBYTE DataB
|
|||
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)
|
||||
{
|
||||
ULONG AddressOffset;
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include "format.h"
|
||||
#include <ddrawi.h>
|
||||
#include <debug.h>
|
||||
#include <d3d9types.h>
|
||||
|
||||
BOOL IsBackBufferFormat(D3DFORMAT Format)
|
||||
{
|
||||
|
|
|
@ -823,6 +823,11 @@ typedef enum _D3DFORMAT {
|
|||
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,
|
||||
D3DFMT_INDEX32 = 102,
|
||||
|
|
Loading…
Reference in a new issue