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?
On Fri, Sep 18, 2009 at 1:36 AM, Henri Verbeet <[email protected]> wrote:
> 2009/9/18 Brian Nguyen <[email protected]>:
> > Hm, okay. I just wanted to test the waters here; I'll rework this to use
> a
> > function that loads
> > a string from a resource file. Does the help message itself look okay? I
> > just used the message
> > provided by the native dxdiag app, but I could rework it if there are
> issues
> > with copyright or
> > wine conventions.
> >
> You usually shouldn't copy anything from native Windows, including
> code, documentation/strings and graphics. So yes, please use your own
> wording for the help message.
>
--
Brian Nguyen
[email protected]
diff --git a/programs/dxdiag/En.rc b/programs/dxdiag/En.rc
new file mode 100644
index 0000000..ed7732b
--- /dev/null
+++ b/programs/dxdiag/En.rc
@@ -0,0 +1,16 @@
+#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\tSave XML information to file <outfile> and quit\n\
+/t outfile\tSave text information to file <outfile> and quit\n\
+/whql:on\tAllow dxdiag to check for Microsoft WHQL signatures\n\
+/whql:off\tDo not allow dxdiag to check for Microsoft WHQL signatures\n\
+The WHQL options are not implemented and are in dxdiag for \
+compatibility reasons.\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..ec61a90 100644
--- a/programs/dxdiag/main.c
+++ b/programs/dxdiag/main.c
@@ -22,6 +22,10 @@
#include <windows.h>
#include "wine/debug.h"
#include "wine/unicode.h"
+#include "dxdiag_res.h"
+
+#define LARGE_STR_SIZE 1024
+#define SMALL_STR_SIZE 128
WINE_DEFAULT_DEBUG_CHANNEL(dxdiag);
@@ -33,6 +37,20 @@ WINE_DEFAULT_DEBUG_CHANNEL(dxdiag);
quotes are optional around the filename, even if it contains spaces.
*/
+/*
+ * Wrapper for LoadString() which handles errors.
+ */
+static LPWSTR DxDiag_LoadString(LPWSTR buf, size_t len, UINT id) {
+ static const WCHAR failed[] = { 'F', 'a', 'i', 'l', 'e', 'd', '!', '\0' };
+
+ if (!LoadStringW(GetModuleHandleW(NULL), id, buf, len)) {
+ WINE_FIXME("LoadString failed with %d\n", GetLastError());
+ strcpyW(buf, failed);
+ }
+
+ return buf;
+}
+
static BOOL ProcessCommandLine(const WCHAR *s)
{
WCHAR outfile[MAX_PATH+1];
@@ -77,8 +95,13 @@ static BOOL ProcessCommandLine(const WCHAR *s)
break;
}
}
- if (opt_help)
- WINE_FIXME("help unimplemented\n");
+ if (opt_help) {
+ WCHAR title[SMALL_STR_SIZE];
+ WCHAR buf[LARGE_STR_SIZE];
+ DxDiag_LoadString(title, SMALL_STR_SIZE, DXDIAG_TITLE);
+ DxDiag_LoadString(buf, LARGE_STR_SIZE, DXDIAG_MESSAGE_HELP);
+ MessageBoxW(NULL, buf, title, MB_OK);
+ }
if (opt_t)
WINE_FIXME("/t unimplemented\n");
if (opt_x)