Commit cc02d954 authored by Robert Reif's avatar Robert Reif Committed by Alexandre Julliard

Added dxerr8 and dxerr9 libraries.

parent 00777ec9
......@@ -190,6 +190,8 @@ Winelib programs (under programs/):
Support programs, libraries, etc:
---------------------------------
dlls/dxerr8/ - DirectX 8 error import lib
dlls/dxerr9/ - DirectX 9 error import lib
dlls/dxguid/ - DirectX UUID import lib
dlls/uuid/ - Windows-compatible UUID import lib
documentation/ - some documentation
......
......@@ -1530,6 +1530,8 @@ dlls/dpnhpast/Makefile
dlls/dsound/Makefile
dlls/dsound/tests/Makefile
dlls/dswave/Makefile
dlls/dxerr8/Makefile
dlls/dxerr9/Makefile
dlls/dxguid/Makefile
dlls/gdi/Makefile
dlls/gdi/tests/Makefile
......
......@@ -156,6 +156,8 @@ SUBDIRS = \
d3d9 \
d3dx8 \
ddraw \
dxerr8 \
dxerr9 \
dxguid \
glu32 \
glut32 \
......@@ -267,6 +269,8 @@ SYMLINKS = \
iphlpapi.dll$(DLLEXT) \
joystick.drv$(DLLEXT) \
kernel32.dll$(DLLEXT) \
libdxerr8.a \
libdxerr9.a \
libdxguid.a \
libuuid.a \
lz32.dll$(DLLEXT) \
......@@ -876,6 +880,12 @@ wsock32.dll$(DLLEXT): wsock32/wsock32.dll$(DLLEXT)
x11drv.dll$(DLLEXT): x11drv/x11drv.dll$(DLLEXT)
$(RM) $@ && $(LN_S) x11drv/x11drv.dll$(DLLEXT) $@
libdxerr8.a: dxerr8/libdxerr8.a
$(RM) $@ && $(LN_S) dxerr8/libdxerr8.a $@
libdxerr9.a: dxerr9/libdxerr9.a
$(RM) $@ && $(LN_S) dxerr9/libdxerr9.a $@
libdxguid.a: dxguid/libdxguid.a
$(RM) $@ && $(LN_S) dxguid/libdxguid.a $@
......@@ -1003,6 +1013,8 @@ IMPORT_LIBS = \
ALL_IMPORT_LIBS = \
$(IMPORT_LIBS:%=%.$(IMPLIBEXT)) \
libdxerr8.a \
libdxerr9.a \
libdxguid.a \
libuuid.a
......@@ -1838,6 +1850,8 @@ wow32/wow32.dll$(DLLEXT): wow32
winsock/ws2_32.dll$(DLLEXT): winsock
wsock32/wsock32.dll$(DLLEXT): wsock32
x11drv/x11drv.dll$(DLLEXT): x11drv
dxerr8/libdxerr8.a: dxerr8
dxerr9/libdxerr9.a: dxerr9
dxguid/libdxguid.a: dxguid
uuid/libuuid.a: uuid
......
Makefile
libdxerr8.a.dbg.c
DEFS = -D__WINESRC__
DLLFLAGS = @DLLFLAGS@
TOPSRCDIR = @top_srcdir@
TOPOBJDIR = ../..
SRCDIR = @srcdir@
VPATH = @srcdir@
MODULE = libdxerr8.a
C_SRCS = \
dxerr8.c
EXTRA_OBJS = $(MODULE).dbg.o
all: $(MODULE)
@MAKE_RULES@
$(MODULE): $(OBJS) Makefile.in
$(RM) $@
$(AR) $@ $(OBJS)
$(RANLIB) $@
man:
doc-html:
doc-sgml:
### Dependencies:
/*
* DirectX 8 error routines
*
* Copyright 2004 Robert Reif
*
* 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
*/
/*
* TODO:
* Add error codes for D3D8, D3DX8, DDRAW, DPLAY8, DMUSIC, DINPUT and DSHOW.
* Sort list for faster lookup.
*/
#include <stdarg.h>
#include <stdio.h>
#define COM_NO_WINDOWS_H
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "winnls.h"
#include "mmsystem.h"
#include "dsound.h"
#include "dxerr8.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(dxerr);
typedef struct {
HRESULT hr;
const CHAR* resultA;
const WCHAR* resultW;
const CHAR* descriptionA;
const WCHAR* descriptionW;
} error_info;
#include "errors.h"
const char * WINAPI DXGetErrorString8A(HRESULT hr)
{
unsigned int i;
TRACE("(0x%08lx)\n", hr);
for (i = 0; i < sizeof(info)/sizeof(info[0]); i++) {
if (hr == info[i].hr)
return info[i].resultA;
}
return "Unknown";
}
const WCHAR * WINAPI DXGetErrorString8W(HRESULT hr)
{
static const WCHAR unknown[] = { 'U', 'n', 'k', 'n', 'o', 'w', 'n', 0 };
unsigned int i;
TRACE("(0x%08lx)\n", hr);
for (i = 0; i < sizeof(info)/sizeof(info[0]); i++) {
if (hr == info[i].hr) {
return info[i].resultW;
}
}
return unknown;
}
const char * WINAPI DXGetErrorDescription8A(HRESULT hr)
{
unsigned int i;
TRACE("(0x%08lx)\n", hr);
for (i = 0; i < sizeof(info)/sizeof(info[0]); i++) {
if (hr == info[i].hr)
return info[i].descriptionA;
}
return "n/a";
}
const WCHAR * WINAPI DXGetErrorDescription8W(HRESULT hr)
{
static const WCHAR na[] = { 'n', '/', 'a', 0 };
unsigned int i;
TRACE("(0x%08lx)\n", hr);
for (i = 0; i < sizeof(info)/sizeof(info[0]); i++) {
if (hr == info[i].hr) {
return info[i].descriptionW;
}
}
return na;
}
HRESULT WINAPI DXTraceA(const char* strFile, DWORD dwLine, HRESULT hr, const char* strMsg, BOOL bPopMsgBox)
{
char msg[1024];
TRACE("(%p,%ld,0x%08lx,%p,%d)\n", strFile, dwLine, hr, strMsg, bPopMsgBox);
if (bPopMsgBox) {
snprintf(msg, sizeof(msg), "File: %s\nLine: %ld\nError Code: %s (0x%08lx)\nCalling: %s",
strFile, dwLine, DXGetErrorString8A(hr), hr, strMsg);
MessageBoxA(0, msg, "Unexpected error encountered", MB_OK|MB_ICONERROR);
} else {
snprintf(msg, sizeof(msg), "%s(%ld): %s (hr=%s (0x%08lx))", strFile,
dwLine, strMsg, DXGetErrorString8A(hr), hr);
OutputDebugStringA(msg);
}
return hr;
}
HRESULT WINAPI DXTraceW(const char* strFile, DWORD dwLine, HRESULT hr, const WCHAR* strMsg, BOOL bPopMsgBox)
{
WCHAR msg[1024];
TRACE("(%p,%ld,0x%08lx,%p,%d)\n", strFile, dwLine, hr, strMsg, bPopMsgBox);
if (bPopMsgBox) {
WCHAR format[] = { 'F','i','l','e',':',' ','%','s','\\','n','L','i','n',
'e',':',' ','%','l','d','\\','n','E','r','r','o','r',' ','C','o',
'd','e',':',' ','%','s',' ','(','0','x','%','0','8','l','x',')',
'\\','n','C','a','l','l','i','n','g',':',' ','%','s',0 };
WCHAR caption[] = { 'U','n','e','x','p','e','c','t','e','d',' ','e','r',
'r','o','r',' ','e','n','c','o','u','n','t','e','r','e','d',0 };
/* FIXME: should use wsnprintf */
wsprintfW(msg, format, strFile, dwLine,
DXGetErrorString8W(hr), hr, strMsg);
MessageBoxW(0, msg, caption, MB_OK|MB_ICONERROR);
} else {
WCHAR format[] = { '%','s','(','%','l','d',')',':',' ','%','s',' ','(',
'h','r','=','%','s',' ','(','0','x','%','0','8','l','x',')',')',' ',
0 };
/* FIXME: should use wsnprintf */
wsprintfW(msg, format, strFile, dwLine, strMsg,
DXGetErrorString8W(hr), hr);
OutputDebugStringW(msg);
}
return hr;
}
BEGIN {
print "/* Machine generated. Do not edit. */"
print ""
lines = 0
}
{
split($0, array, FS)
if (NF > 0 && length(array[1]) > 0) {
lines++
# save the first word is the names array
names[lines] = array[1]
# create the WCHAR version of the name
printf "static const WCHAR name%dW[] = { ", lines
i = 1
len = length(array[1]) + 1
while (i < len) {
printf "'%s',", substr(array[1],i,1)
i++
}
print "0 };"
# create the CHAR version of the description
printf "static const CHAR description%dA[] = \"", lines
word = 2
while (word < (NF + 1)) {
printf "%s", array[word]
if (word < NF )
printf " "
word++
}
print "\";"
# create the WCHAR version of the description
printf "static const WCHAR description%dW[] = { ", lines
word = 2
while (word < (NF + 1)) {
i = 1
len = length(array[word]) + 1
while (i < len) {
printf "'%s',", substr(array[word],i,1)
i++
}
if (word < NF )
printf "' ',"
word++
}
print "0 };"
}
}
END {
print ""
print "static const error_info info[] = {"
i = 1
while ( i <= lines) {
printf " { %s, \"%s\", name%dW, description%dA, description%dW },\n",
names[i], names[i], i, i,i
i++
}
print "};"
}
S_OK Succeeded
DS_NO_VIRTUALIZATION Succeeded but with different 3D algorithn
DS_INCOMPLETE Succeeded but not with all effects
DSERR_ALLOCATED Already allocated
DSERR_CONTROLUNAVAIL Control unavailable
E_INVALIDARG Invalid argument
DSERR_INVALIDCALL Invalid call
E_FAIL Undetermined error
DSERR_PRIOLEVELNEEDED Insufficiant priority level
E_OUTOFMEMORY Out of memory
DSERR_BADFORMAT Bad WAVE format
E_NOTIMPL Not implemented
DSERR_NODRIVER No driver
DSERR_ALREADYINITIALIZED Already initialized
CLASS_E_NOAGGREGATION No aggregation
DSERR_BUFFERLOST Buffer lost
DSERR_OTHERAPPHASPRIO Other app has higher priority
DSERR_UNINITIALIZED Not initialized
E_NOINTERFACE No interface
E_ACCESSDENIED Access denied
DSERR_BUFFERTOOSMALL Buffer too small
DSERR_DS8_REQUIRED Direct Sound 8 required
DSERR_SENDLOOP Circular loop
DSERR_BADSENDBUFFERGUID Bad send buffer GUID
DSERR_OBJECTNOTFOUND Object not found
DSERR_FXUNAVAILABLE Effect not available
/* Machine generated. Do not edit. */
static const WCHAR name1W[] = { 'S','_','O','K',0 };
static const CHAR description1A[] = "Succeeded";
static const WCHAR description1W[] = { 'S','u','c','c','e','e','d','e','d',0 };
static const WCHAR name2W[] = { 'D','S','_','N','O','_','V','I','R','T','U','A','L','I','Z','A','T','I','O','N',0 };
static const CHAR description2A[] = "Succeeded but with different 3D algorithn";
static const WCHAR description2W[] = { 'S','u','c','c','e','e','d','e','d',' ','b','u','t',' ','w','i','t','h',' ','d','i','f','f','e','r','e','n','t',' ','3','D',' ','a','l','g','o','r','i','t','h','n',0 };
static const WCHAR name3W[] = { 'D','S','_','I','N','C','O','M','P','L','E','T','E',0 };
static const CHAR description3A[] = "Succeeded but not with all effects";
static const WCHAR description3W[] = { 'S','u','c','c','e','e','d','e','d',' ','b','u','t',' ','n','o','t',' ','w','i','t','h',' ','a','l','l',' ','e','f','f','e','c','t','s',0 };
static const WCHAR name4W[] = { 'D','S','E','R','R','_','A','L','L','O','C','A','T','E','D',0 };
static const CHAR description4A[] = "Already allocated";
static const WCHAR description4W[] = { 'A','l','r','e','a','d','y',' ','a','l','l','o','c','a','t','e','d',0 };
static const WCHAR name5W[] = { 'D','S','E','R','R','_','C','O','N','T','R','O','L','U','N','A','V','A','I','L',0 };
static const CHAR description5A[] = "Control unavailable";
static const WCHAR description5W[] = { 'C','o','n','t','r','o','l',' ','u','n','a','v','a','i','l','a','b','l','e',0 };
static const WCHAR name6W[] = { 'E','_','I','N','V','A','L','I','D','A','R','G',0 };
static const CHAR description6A[] = "Invalid argument";
static const WCHAR description6W[] = { 'I','n','v','a','l','i','d',' ','a','r','g','u','m','e','n','t',0 };
static const WCHAR name7W[] = { 'D','S','E','R','R','_','I','N','V','A','L','I','D','C','A','L','L',0 };
static const CHAR description7A[] = "Invalid call";
static const WCHAR description7W[] = { 'I','n','v','a','l','i','d',' ','c','a','l','l',0 };
static const WCHAR name8W[] = { 'E','_','F','A','I','L',0 };
static const CHAR description8A[] = "Undetermined error";
static const WCHAR description8W[] = { 'U','n','d','e','t','e','r','m','i','n','e','d',' ','e','r','r','o','r',0 };
static const WCHAR name9W[] = { 'D','S','E','R','R','_','P','R','I','O','L','E','V','E','L','N','E','E','D','E','D',0 };
static const CHAR description9A[] = "Insufficiant priority level";
static const WCHAR description9W[] = { 'I','n','s','u','f','f','i','c','i','a','n','t',' ','p','r','i','o','r','i','t','y',' ','l','e','v','e','l',0 };
static const WCHAR name10W[] = { 'E','_','O','U','T','O','F','M','E','M','O','R','Y',0 };
static const CHAR description10A[] = "Out of memory";
static const WCHAR description10W[] = { 'O','u','t',' ','o','f',' ','m','e','m','o','r','y',0 };
static const WCHAR name11W[] = { 'D','S','E','R','R','_','B','A','D','F','O','R','M','A','T',0 };
static const CHAR description11A[] = "Bad WAVE format";
static const WCHAR description11W[] = { 'B','a','d',' ','W','A','V','E',' ','f','o','r','m','a','t',0 };
static const WCHAR name12W[] = { 'E','_','N','O','T','I','M','P','L',0 };
static const CHAR description12A[] = "Not implemented";
static const WCHAR description12W[] = { 'N','o','t',' ','i','m','p','l','e','m','e','n','t','e','d',0 };
static const WCHAR name13W[] = { 'D','S','E','R','R','_','N','O','D','R','I','V','E','R',0 };
static const CHAR description13A[] = "No driver";
static const WCHAR description13W[] = { 'N','o',' ','d','r','i','v','e','r',0 };
static const WCHAR name14W[] = { 'D','S','E','R','R','_','A','L','R','E','A','D','Y','I','N','I','T','I','A','L','I','Z','E','D',0 };
static const CHAR description14A[] = "Already initialized";
static const WCHAR description14W[] = { 'A','l','r','e','a','d','y',' ','i','n','i','t','i','a','l','i','z','e','d',0 };
static const WCHAR name15W[] = { 'C','L','A','S','S','_','E','_','N','O','A','G','G','R','E','G','A','T','I','O','N',0 };
static const CHAR description15A[] = "No aggregation";
static const WCHAR description15W[] = { 'N','o',' ','a','g','g','r','e','g','a','t','i','o','n',0 };
static const WCHAR name16W[] = { 'D','S','E','R','R','_','B','U','F','F','E','R','L','O','S','T',0 };
static const CHAR description16A[] = "Buffer lost";
static const WCHAR description16W[] = { 'B','u','f','f','e','r',' ','l','o','s','t',0 };
static const WCHAR name17W[] = { 'D','S','E','R','R','_','O','T','H','E','R','A','P','P','H','A','S','P','R','I','O',0 };
static const CHAR description17A[] = "Other app has higher priority";
static const WCHAR description17W[] = { 'O','t','h','e','r',' ','a','p','p',' ','h','a','s',' ','h','i','g','h','e','r',' ','p','r','i','o','r','i','t','y',0 };
static const WCHAR name18W[] = { 'D','S','E','R','R','_','U','N','I','N','I','T','I','A','L','I','Z','E','D',0 };
static const CHAR description18A[] = "Not initialized";
static const WCHAR description18W[] = { 'N','o','t',' ','i','n','i','t','i','a','l','i','z','e','d',0 };
static const WCHAR name19W[] = { 'E','_','N','O','I','N','T','E','R','F','A','C','E',0 };
static const CHAR description19A[] = "No interface";
static const WCHAR description19W[] = { 'N','o',' ','i','n','t','e','r','f','a','c','e',0 };
static const WCHAR name20W[] = { 'E','_','A','C','C','E','S','S','D','E','N','I','E','D',0 };
static const CHAR description20A[] = "Access denied";
static const WCHAR description20W[] = { 'A','c','c','e','s','s',' ','d','e','n','i','e','d',0 };
static const WCHAR name21W[] = { 'D','S','E','R','R','_','B','U','F','F','E','R','T','O','O','S','M','A','L','L',0 };
static const CHAR description21A[] = "Buffer too small";
static const WCHAR description21W[] = { 'B','u','f','f','e','r',' ','t','o','o',' ','s','m','a','l','l',0 };
static const WCHAR name22W[] = { 'D','S','E','R','R','_','D','S','8','_','R','E','Q','U','I','R','E','D',0 };
static const CHAR description22A[] = "Direct Sound 8 required";
static const WCHAR description22W[] = { 'D','i','r','e','c','t',' ','S','o','u','n','d',' ','8',' ','r','e','q','u','i','r','e','d',0 };
static const WCHAR name23W[] = { 'D','S','E','R','R','_','S','E','N','D','L','O','O','P',0 };
static const CHAR description23A[] = "Circular loop";
static const WCHAR description23W[] = { 'C','i','r','c','u','l','a','r',' ','l','o','o','p',0 };
static const WCHAR name24W[] = { 'D','S','E','R','R','_','B','A','D','S','E','N','D','B','U','F','F','E','R','G','U','I','D',0 };
static const CHAR description24A[] = "Bad send buffer GUID";
static const WCHAR description24W[] = { 'B','a','d',' ','s','e','n','d',' ','b','u','f','f','e','r',' ','G','U','I','D',0 };
static const WCHAR name25W[] = { 'D','S','E','R','R','_','O','B','J','E','C','T','N','O','T','F','O','U','N','D',0 };
static const CHAR description25A[] = "Object not found";
static const WCHAR description25W[] = { 'O','b','j','e','c','t',' ','n','o','t',' ','f','o','u','n','d',0 };
static const WCHAR name26W[] = { 'D','S','E','R','R','_','F','X','U','N','A','V','A','I','L','A','B','L','E',0 };
static const CHAR description26A[] = "Effect not available";
static const WCHAR description26W[] = { 'E','f','f','e','c','t',' ','n','o','t',' ','a','v','a','i','l','a','b','l','e',0 };
static const error_info info[] = {
{ S_OK, "S_OK", name1W, description1A, description1W },
{ DS_NO_VIRTUALIZATION, "DS_NO_VIRTUALIZATION", name2W, description2A, description2W },
{ DS_INCOMPLETE, "DS_INCOMPLETE", name3W, description3A, description3W },
{ DSERR_ALLOCATED, "DSERR_ALLOCATED", name4W, description4A, description4W },
{ DSERR_CONTROLUNAVAIL, "DSERR_CONTROLUNAVAIL", name5W, description5A, description5W },
{ E_INVALIDARG, "E_INVALIDARG", name6W, description6A, description6W },
{ DSERR_INVALIDCALL, "DSERR_INVALIDCALL", name7W, description7A, description7W },
{ E_FAIL, "E_FAIL", name8W, description8A, description8W },
{ DSERR_PRIOLEVELNEEDED, "DSERR_PRIOLEVELNEEDED", name9W, description9A, description9W },
{ E_OUTOFMEMORY, "E_OUTOFMEMORY", name10W, description10A, description10W },
{ DSERR_BADFORMAT, "DSERR_BADFORMAT", name11W, description11A, description11W },
{ E_NOTIMPL, "E_NOTIMPL", name12W, description12A, description12W },
{ DSERR_NODRIVER, "DSERR_NODRIVER", name13W, description13A, description13W },
{ DSERR_ALREADYINITIALIZED, "DSERR_ALREADYINITIALIZED", name14W, description14A, description14W },
{ CLASS_E_NOAGGREGATION, "CLASS_E_NOAGGREGATION", name15W, description15A, description15W },
{ DSERR_BUFFERLOST, "DSERR_BUFFERLOST", name16W, description16A, description16W },
{ DSERR_OTHERAPPHASPRIO, "DSERR_OTHERAPPHASPRIO", name17W, description17A, description17W },
{ DSERR_UNINITIALIZED, "DSERR_UNINITIALIZED", name18W, description18A, description18W },
{ E_NOINTERFACE, "E_NOINTERFACE", name19W, description19A, description19W },
{ E_ACCESSDENIED, "E_ACCESSDENIED", name20W, description20A, description20W },
{ DSERR_BUFFERTOOSMALL, "DSERR_BUFFERTOOSMALL", name21W, description21A, description21W },
{ DSERR_DS8_REQUIRED, "DSERR_DS8_REQUIRED", name22W, description22A, description22W },
{ DSERR_SENDLOOP, "DSERR_SENDLOOP", name23W, description23A, description23W },
{ DSERR_BADSENDBUFFERGUID, "DSERR_BADSENDBUFFERGUID", name24W, description24A, description24W },
{ DSERR_OBJECTNOTFOUND, "DSERR_OBJECTNOTFOUND", name25W, description25A, description25W },
{ DSERR_FXUNAVAILABLE, "DSERR_FXUNAVAILABLE", name26W, description26A, description26W },
};
#!/bin/sh
exec awk -f errors.awk < errors.dat > errors.h
Makefile
libdxerr9.a.dbg.c
DEFS = -D__WINESRC__
DLLFLAGS = @DLLFLAGS@
TOPSRCDIR = @top_srcdir@
TOPOBJDIR = ../..
SRCDIR = @srcdir@
VPATH = @srcdir@
MODULE = libdxerr9.a
C_SRCS = \
dxerr9.c
EXTRA_OBJS = $(MODULE).dbg.o
all: $(MODULE)
@MAKE_RULES@
$(MODULE): $(OBJS) Makefile.in
$(RM) $@
$(AR) $@ $(OBJS)
$(RANLIB) $@
man:
doc-html:
doc-sgml:
### Dependencies:
/*
* DirectX 9 error routines
*
* Copyright 2004 Robert Reif
*
* 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
*/
/*
* TODO:
* Add error codes for D3D9, D3DX9, D3D8, D3DX8, DDRAW, DPLAY8, DMUSIC, DINPUT and DSHOW.
* Sort list for faster lookup.
*/
#include <stdarg.h>
#include <stdio.h>
#define COM_NO_WINDOWS_H
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "winnls.h"
#include "mmsystem.h"
#include "dsound.h"
#include "dxerr9.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(dxerr);
typedef struct {
HRESULT hr;
const CHAR* resultA;
const WCHAR* resultW;
const CHAR* descriptionA;
const WCHAR* descriptionW;
} error_info;
#include "errors.h"
const char * WINAPI DXGetErrorString9A(HRESULT hr)
{
unsigned int i;
TRACE("(0x%08lx)\n", hr);
for (i = 0; i < sizeof(info)/sizeof(info[0]); i++) {
if (hr == info[i].hr)
return info[i].resultA;
}
return "Unknown";
}
const WCHAR * WINAPI DXGetErrorString9W(HRESULT hr)
{
static const WCHAR unknown[] = { 'U', 'n', 'k', 'n', 'o', 'w', 'n', 0 };
unsigned int i;
TRACE("(0x%08lx)\n", hr);
for (i = 0; i < sizeof(info)/sizeof(info[0]); i++) {
if (hr == info[i].hr) {
return info[i].resultW;
}
}
return unknown;
}
const char * WINAPI DXGetErrorDescription9A(HRESULT hr)
{
unsigned int i;
TRACE("(0x%08lx)\n", hr);
for (i = 0; i < sizeof(info)/sizeof(info[0]); i++) {
if (hr == info[i].hr)
return info[i].descriptionA;
}
return "n/a";
}
const WCHAR * WINAPI DXGetErrorDescription9W(HRESULT hr)
{
static const WCHAR na[] = { 'n', '/', 'a', 0 };
unsigned int i;
TRACE("(0x%08lx)\n", hr);
for (i = 0; i < sizeof(info)/sizeof(info[0]); i++) {
if (hr == info[i].hr) {
return info[i].descriptionW;
}
}
return na;
}
HRESULT WINAPI DXTraceA(const char* strFile, DWORD dwLine, HRESULT hr, const char* strMsg, BOOL bPopMsgBox)
{
char msg[1024];
TRACE("(%p,%ld,0x%08lx,%p,%d)\n", strFile, dwLine, hr, strMsg, bPopMsgBox);
if (bPopMsgBox) {
snprintf(msg, sizeof(msg), "File: %s\nLine: %ld\nError Code: %s (0x%08lx)\nCalling: %s",
strFile, dwLine, DXGetErrorString9A(hr), hr, strMsg);
MessageBoxA(0, msg, "Unexpected error encountered", MB_OK|MB_ICONERROR);
} else {
snprintf(msg, sizeof(msg), "%s(%ld): %s (hr=%s (0x%08lx))", strFile,
dwLine, strMsg, DXGetErrorString9A(hr), hr);
OutputDebugStringA(msg);
}
return hr;
}
HRESULT WINAPI DXTraceW(const char* strFile, DWORD dwLine, HRESULT hr, const WCHAR* strMsg, BOOL bPopMsgBox)
{
WCHAR msg[1024];
TRACE("(%p,%ld,0x%08lx,%p,%d)\n", strFile, dwLine, hr, strMsg, bPopMsgBox);
if (bPopMsgBox) {
WCHAR format[] = { 'F','i','l','e',':',' ','%','s','\\','n','L','i','n',
'e',':',' ','%','l','d','\\','n','E','r','r','o','r',' ','C','o',
'd','e',':',' ','%','s',' ','(','0','x','%','0','8','l','x',')',
'\\','n','C','a','l','l','i','n','g',':',' ','%','s',0 };
WCHAR caption[] = { 'U','n','e','x','p','e','c','t','e','d',' ','e','r',
'r','o','r',' ','e','n','c','o','u','n','t','e','r','e','d',0 };
/* FIXME: should use wsnprintf */
wsprintfW(msg, format, strFile, dwLine,
DXGetErrorString9W(hr), hr, strMsg);
MessageBoxW(0, msg, caption, MB_OK|MB_ICONERROR);
} else {
WCHAR format[] = { '%','s','(','%','l','d',')',':',' ','%','s',' ','(',
'h','r','=','%','s',' ','(','0','x','%','0','8','l','x',')',')',' ',
0 };
/* FIXME: should use wsnprintf */
wsprintfW(msg, format, strFile, dwLine, strMsg,
DXGetErrorString9W(hr), hr);
OutputDebugStringW(msg);
}
return hr;
}
BEGIN {
print "/* Machine generated. Do not edit. */"
print ""
lines = 0
}
{
split($0, array, FS)
if (NF > 0 && length(array[1]) > 0) {
lines++
# save the first word is the names array
names[lines] = array[1]
# create the WCHAR version of the name
printf "static const WCHAR name%dW[] = { ", lines
i = 1
len = length(array[1]) + 1
while (i < len) {
printf "'%s',", substr(array[1],i,1)
i++
}
print "0 };"
# create the CHAR version of the description
printf "static const CHAR description%dA[] = \"", lines
word = 2
while (word < (NF + 1)) {
printf "%s", array[word]
if (word < NF )
printf " "
word++
}
print "\";"
# create the WCHAR version of the description
printf "static const WCHAR description%dW[] = { ", lines
word = 2
while (word < (NF + 1)) {
i = 1
len = length(array[word]) + 1
while (i < len) {
printf "'%s',", substr(array[word],i,1)
i++
}
if (word < NF )
printf "' ',"
word++
}
print "0 };"
}
}
END {
print ""
print "static const error_info info[] = {"
i = 1
while ( i <= lines) {
printf " { %s, \"%s\", name%dW, description%dA, description%dW },\n",
names[i], names[i], i, i,i
i++
}
print "};"
}
S_OK Succeeded
DS_NO_VIRTUALIZATION Succeeded but with different 3D algorithn
DSERR_ALLOCATED Already allocated
DSERR_CONTROLUNAVAIL Control unavailable
E_INVALIDARG Invalid argument
DSERR_INVALIDCALL Invalid call
E_FAIL Undetermined error
DSERR_PRIOLEVELNEEDED Insufficiant priority level
E_OUTOFMEMORY Out of memory
DSERR_BADFORMAT Bad WAVE format
E_NOTIMPL Not implemented
DSERR_NODRIVER No driver
DSERR_ALREADYINITIALIZED Already initialized
CLASS_E_NOAGGREGATION No aggregation
DSERR_BUFFERLOST Buffer lost
DSERR_OTHERAPPHASPRIO Other app has higher priority
DSERR_UNINITIALIZED Not initialized
E_NOINTERFACE No interface
E_ACCESSDENIED Access denied
DSERR_BUFFERTOOSMALL Buffer too small
DSERR_DS8_REQUIRED Direct Sound 8 required
DSERR_SENDLOOP Circular loop
DSERR_BADSENDBUFFERGUID Bad send buffer GUID
DSERR_OBJECTNOTFOUND Object not found
DSERR_FXUNAVAILABLE Effect not available
/* Machine generated. Do not edit. */
static const WCHAR name1W[] = { 'S','_','O','K',0 };
static const CHAR description1A[] = "Succeeded";
static const WCHAR description1W[] = { 'S','u','c','c','e','e','d','e','d',0 };
static const WCHAR name2W[] = { 'D','S','_','N','O','_','V','I','R','T','U','A','L','I','Z','A','T','I','O','N',0 };
static const CHAR description2A[] = "Succeeded but with different 3D algorithn";
static const WCHAR description2W[] = { 'S','u','c','c','e','e','d','e','d',' ','b','u','t',' ','w','i','t','h',' ','d','i','f','f','e','r','e','n','t',' ','3','D',' ','a','l','g','o','r','i','t','h','n',0 };
static const WCHAR name3W[] = { 'D','S','E','R','R','_','A','L','L','O','C','A','T','E','D',0 };
static const CHAR description3A[] = "Already allocated";
static const WCHAR description3W[] = { 'A','l','r','e','a','d','y',' ','a','l','l','o','c','a','t','e','d',0 };
static const WCHAR name4W[] = { 'D','S','E','R','R','_','C','O','N','T','R','O','L','U','N','A','V','A','I','L',0 };
static const CHAR description4A[] = "Control unavailable";
static const WCHAR description4W[] = { 'C','o','n','t','r','o','l',' ','u','n','a','v','a','i','l','a','b','l','e',0 };
static const WCHAR name5W[] = { 'E','_','I','N','V','A','L','I','D','A','R','G',0 };
static const CHAR description5A[] = "Invalid argument";
static const WCHAR description5W[] = { 'I','n','v','a','l','i','d',' ','a','r','g','u','m','e','n','t',0 };
static const WCHAR name6W[] = { 'D','S','E','R','R','_','I','N','V','A','L','I','D','C','A','L','L',0 };
static const CHAR description6A[] = "Invalid call";
static const WCHAR description6W[] = { 'I','n','v','a','l','i','d',' ','c','a','l','l',0 };
static const WCHAR name7W[] = { 'E','_','F','A','I','L',0 };
static const CHAR description7A[] = "Undetermined error";
static const WCHAR description7W[] = { 'U','n','d','e','t','e','r','m','i','n','e','d',' ','e','r','r','o','r',0 };
static const WCHAR name8W[] = { 'D','S','E','R','R','_','P','R','I','O','L','E','V','E','L','N','E','E','D','E','D',0 };
static const CHAR description8A[] = "Insufficiant priority level";
static const WCHAR description8W[] = { 'I','n','s','u','f','f','i','c','i','a','n','t',' ','p','r','i','o','r','i','t','y',' ','l','e','v','e','l',0 };
static const WCHAR name9W[] = { 'E','_','O','U','T','O','F','M','E','M','O','R','Y',0 };
static const CHAR description9A[] = "Out of memory";
static const WCHAR description9W[] = { 'O','u','t',' ','o','f',' ','m','e','m','o','r','y',0 };
static const WCHAR name10W[] = { 'D','S','E','R','R','_','B','A','D','F','O','R','M','A','T',0 };
static const CHAR description10A[] = "Bad WAVE format";
static const WCHAR description10W[] = { 'B','a','d',' ','W','A','V','E',' ','f','o','r','m','a','t',0 };
static const WCHAR name11W[] = { 'E','_','N','O','T','I','M','P','L',0 };
static const CHAR description11A[] = "Not implemented";
static const WCHAR description11W[] = { 'N','o','t',' ','i','m','p','l','e','m','e','n','t','e','d',0 };
static const WCHAR name12W[] = { 'D','S','E','R','R','_','N','O','D','R','I','V','E','R',0 };
static const CHAR description12A[] = "No driver";
static const WCHAR description12W[] = { 'N','o',' ','d','r','i','v','e','r',0 };
static const WCHAR name13W[] = { 'D','S','E','R','R','_','A','L','R','E','A','D','Y','I','N','I','T','I','A','L','I','Z','E','D',0 };
static const CHAR description13A[] = "Already initialized";
static const WCHAR description13W[] = { 'A','l','r','e','a','d','y',' ','i','n','i','t','i','a','l','i','z','e','d',0 };
static const WCHAR name14W[] = { 'C','L','A','S','S','_','E','_','N','O','A','G','G','R','E','G','A','T','I','O','N',0 };
static const CHAR description14A[] = "No aggregation";
static const WCHAR description14W[] = { 'N','o',' ','a','g','g','r','e','g','a','t','i','o','n',0 };
static const WCHAR name15W[] = { 'D','S','E','R','R','_','B','U','F','F','E','R','L','O','S','T',0 };
static const CHAR description15A[] = "Buffer lost";
static const WCHAR description15W[] = { 'B','u','f','f','e','r',' ','l','o','s','t',0 };
static const WCHAR name16W[] = { 'D','S','E','R','R','_','O','T','H','E','R','A','P','P','H','A','S','P','R','I','O',0 };
static const CHAR description16A[] = "Other app has higher priority";
static const WCHAR description16W[] = { 'O','t','h','e','r',' ','a','p','p',' ','h','a','s',' ','h','i','g','h','e','r',' ','p','r','i','o','r','i','t','y',0 };
static const WCHAR name17W[] = { 'D','S','E','R','R','_','U','N','I','N','I','T','I','A','L','I','Z','E','D',0 };
static const CHAR description17A[] = "Not initialized";
static const WCHAR description17W[] = { 'N','o','t',' ','i','n','i','t','i','a','l','i','z','e','d',0 };
static const WCHAR name18W[] = { 'E','_','N','O','I','N','T','E','R','F','A','C','E',0 };
static const CHAR description18A[] = "No interface";
static const WCHAR description18W[] = { 'N','o',' ','i','n','t','e','r','f','a','c','e',0 };
static const WCHAR name19W[] = { 'E','_','A','C','C','E','S','S','D','E','N','I','E','D',0 };
static const CHAR description19A[] = "Access denied";
static const WCHAR description19W[] = { 'A','c','c','e','s','s',' ','d','e','n','i','e','d',0 };
static const WCHAR name20W[] = { 'D','S','E','R','R','_','B','U','F','F','E','R','T','O','O','S','M','A','L','L',0 };
static const CHAR description20A[] = "Buffer too small";
static const WCHAR description20W[] = { 'B','u','f','f','e','r',' ','t','o','o',' ','s','m','a','l','l',0 };
static const WCHAR name21W[] = { 'D','S','E','R','R','_','D','S','8','_','R','E','Q','U','I','R','E','D',0 };
static const CHAR description21A[] = "Direct Sound 8 required";
static const WCHAR description21W[] = { 'D','i','r','e','c','t',' ','S','o','u','n','d',' ','8',' ','r','e','q','u','i','r','e','d',0 };
static const WCHAR name22W[] = { 'D','S','E','R','R','_','S','E','N','D','L','O','O','P',0 };
static const CHAR description22A[] = "Circular loop";
static const WCHAR description22W[] = { 'C','i','r','c','u','l','a','r',' ','l','o','o','p',0 };
static const WCHAR name23W[] = { 'D','S','E','R','R','_','B','A','D','S','E','N','D','B','U','F','F','E','R','G','U','I','D',0 };
static const CHAR description23A[] = "Bad send buffer GUID";
static const WCHAR description23W[] = { 'B','a','d',' ','s','e','n','d',' ','b','u','f','f','e','r',' ','G','U','I','D',0 };
static const WCHAR name24W[] = { 'D','S','E','R','R','_','O','B','J','E','C','T','N','O','T','F','O','U','N','D',0 };
static const CHAR description24A[] = "Object not found";
static const WCHAR description24W[] = { 'O','b','j','e','c','t',' ','n','o','t',' ','f','o','u','n','d',0 };
static const WCHAR name25W[] = { 'D','S','E','R','R','_','F','X','U','N','A','V','A','I','L','A','B','L','E',0 };
static const CHAR description25A[] = "Effect not available";
static const WCHAR description25W[] = { 'E','f','f','e','c','t',' ','n','o','t',' ','a','v','a','i','l','a','b','l','e',0 };
static const error_info info[] = {
{ S_OK, "S_OK", name1W, description1A, description1W },
{ DS_NO_VIRTUALIZATION, "DS_NO_VIRTUALIZATION", name2W, description2A, description2W },
{ DSERR_ALLOCATED, "DSERR_ALLOCATED", name3W, description3A, description3W },
{ DSERR_CONTROLUNAVAIL, "DSERR_CONTROLUNAVAIL", name4W, description4A, description4W },
{ E_INVALIDARG, "E_INVALIDARG", name5W, description5A, description5W },
{ DSERR_INVALIDCALL, "DSERR_INVALIDCALL", name6W, description6A, description6W },
{ E_FAIL, "E_FAIL", name7W, description7A, description7W },
{ DSERR_PRIOLEVELNEEDED, "DSERR_PRIOLEVELNEEDED", name8W, description8A, description8W },
{ E_OUTOFMEMORY, "E_OUTOFMEMORY", name9W, description9A, description9W },
{ DSERR_BADFORMAT, "DSERR_BADFORMAT", name10W, description10A, description10W },
{ E_NOTIMPL, "E_NOTIMPL", name11W, description11A, description11W },
{ DSERR_NODRIVER, "DSERR_NODRIVER", name12W, description12A, description12W },
{ DSERR_ALREADYINITIALIZED, "DSERR_ALREADYINITIALIZED", name13W, description13A, description13W },
{ CLASS_E_NOAGGREGATION, "CLASS_E_NOAGGREGATION", name14W, description14A, description14W },
{ DSERR_BUFFERLOST, "DSERR_BUFFERLOST", name15W, description15A, description15W },
{ DSERR_OTHERAPPHASPRIO, "DSERR_OTHERAPPHASPRIO", name16W, description16A, description16W },
{ DSERR_UNINITIALIZED, "DSERR_UNINITIALIZED", name17W, description17A, description17W },
{ E_NOINTERFACE, "E_NOINTERFACE", name18W, description18A, description18W },
{ E_ACCESSDENIED, "E_ACCESSDENIED", name19W, description19A, description19W },
{ DSERR_BUFFERTOOSMALL, "DSERR_BUFFERTOOSMALL", name20W, description20A, description20W },
{ DSERR_DS8_REQUIRED, "DSERR_DS8_REQUIRED", name21W, description21A, description21W },
{ DSERR_SENDLOOP, "DSERR_SENDLOOP", name22W, description22A, description22W },
{ DSERR_BADSENDBUFFERGUID, "DSERR_BADSENDBUFFERGUID", name23W, description23A, description23W },
{ DSERR_OBJECTNOTFOUND, "DSERR_OBJECTNOTFOUND", name24W, description24A, description24W },
{ DSERR_FXUNAVAILABLE, "DSERR_FXUNAVAILABLE", name25W, description25A, description25W },
};
#!/bin/sh
exec awk -f errors.awk < errors.dat > errors.h
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment