Thanks for the suggestion; I didn't realize you could get a pointer to the
string itself. Here's an updated patch. I also changed the wording some more
to make it less similar to the native dxdiag.
On Sat, Sep 19, 2009 at 12:05 PM, Henri Verbeet <[email protected]> wrote:
> 2009/9/18 Brian Nguyen <[email protected]>:
> > Here's an updated patch that stores the string in an En.rc resource file
> and
> > loads it using a wrapper for LoadString. How does this look?
> >
> I think that should work, but how about something like this:
>
> static const WCHAR *DxDiag_LoadString(UINT id)
> {
> static const WCHAR failed[] = { 'F', 'a', 'i', 'l', 'e', 'd', '!', '\0'
> };
> const WCHAR *ret;
>
> if (!LoadStringW(GetModuleHandleW(NULL), id, (WCHAR *)&ret, 0))
> {
> WINE_FIXME("Failed to load string %u, last error %u.\n",
> id, GetLastError());
> return failed;
> }
>
> return ret;
> }
>
> > + DXDIAG_MESSAGE_HELP,
> You have a trailing space here.
>
--
Brian Nguyen
[email protected]
diff --git a/programs/dxdiag/En.rc b/programs/dxdiag/En.rc
new file mode 100644
index 0000000..d1c1e48
--- /dev/null
+++ b/programs/dxdiag/En.rc
@@ -0,0 +1,13 @@
+#include "dxdiag_res.h"
+
+STRINGTABLE
+{
+ DXDIAG_TITLE, "DirectX Diagnostic Tool"
+ DXDIAG_MESSAGE_HELP,
+"Usage: dxdiag [/x OUTFILE] [/t OUTFILE] [/whql:{on|off}]\n\
+\n\
+/x outfile\tThis option saves dxdiag information as an XML file.\n\
+/t outfile\tThis option saves dxdiag information as text.\n\
+/whql:{on|off}\tAllow/deny dxdiag check for Microsoft WHQL signatures \
+(unimplemented)\n"
+}
diff --git a/programs/dxdiag/Makefile.in b/programs/dxdiag/Makefile.in
index a8dd0d9..711d0da 100644
--- a/programs/dxdiag/Makefile.in
+++ b/programs/dxdiag/Makefile.in
@@ -5,11 +5,14 @@ SRCDIR = @srcdir@
VPATH = @srcdir@
MODULE = dxdiag.exe
APPMODE = -mwindows -municode
-IMPORTS = kernel32
+IMPORTS = kernel32 user32
C_SRCS = \
main.c
+RC_SRCS = \
+ En.rc
+
@MAKE_PROG_RULES@
@DEPENDENCIES@ # everything below this line is overwritten by make depend
diff --git a/programs/dxdiag/dxdiag_res.h b/programs/dxdiag/dxdiag_res.h
new file mode 100644
index 0000000..3b75a66
--- /dev/null
+++ b/programs/dxdiag/dxdiag_res.h
@@ -0,0 +1,8 @@
+#ifndef DXDIAG_RES_H
+#define DXDIAG_RES_H
+
+#define DXDIAG_TITLE 1
+
+#define DXDIAG_MESSAGE_HELP 100
+
+#endif
diff --git a/programs/dxdiag/main.c b/programs/dxdiag/main.c
index 4e73b4b..7511659 100644
--- a/programs/dxdiag/main.c
+++ b/programs/dxdiag/main.c
@@ -22,6 +22,7 @@
#include <windows.h>
#include "wine/debug.h"
#include "wine/unicode.h"
+#include "dxdiag_res.h"
WINE_DEFAULT_DEBUG_CHANNEL(dxdiag);
@@ -33,6 +34,21 @@ WINE_DEFAULT_DEBUG_CHANNEL(dxdiag);
quotes are optional around the filename, even if it contains spaces.
*/
+/*
+ * Wrapper for LoadString() which handles errors.
+ */
+static LPCWSTR DxDiag_LoadString(UINT id) {
+ static const WCHAR failed[] = { 'F', 'a', 'i', 'l', 'e', 'd', '!', '\0' };
+ LPCWSTR ret;
+
+ if (!LoadStringW(GetModuleHandleW(NULL), id, (WCHAR*)&ret, 0)) {
+ WINE_FIXME("LoadString failed with %u, last error %u\n", id, GetLastError());
+ return failed;
+ }
+
+ return ret;
+}
+
static BOOL ProcessCommandLine(const WCHAR *s)
{
WCHAR outfile[MAX_PATH+1];
@@ -77,8 +93,10 @@ static BOOL ProcessCommandLine(const WCHAR *s)
break;
}
}
- if (opt_help)
- WINE_FIXME("help unimplemented\n");
+ if (opt_help) {
+ MessageBoxW(NULL, DxDiag_LoadString(DXDIAG_MESSAGE_HELP),
+ DxDiag_LoadString(DXDIAG_TITLE), MB_OK);
+ }
if (opt_t)
WINE_FIXME("/t unimplemented\n");
if (opt_x)