Fix multi-leg promotions
[xboard.git] / winboard / help.c
index febd0e6..e1e0345 100644 (file)
@@ -1,7 +1,7 @@
 /*\r
  * help.h\r
  *\r
- * Copyright 2009 Free Software Foundation, Inc.\r
+ * Copyright 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016 Free Software Foundation, Inc.\r
  * ------------------------------------------------------------------------\r
  *\r
  * GNU XBoard is free software: you can redistribute it and/or modify\r
 \r
 #include <windows.h>\r
 #include <stdio.h>\r
+#include "config.h"
+#include "help.h"
 \r
 FILE *debugFP;\r
 \r
-int\r
-HtmlHelp( HWND hwnd, LPCSTR helpFile, UINT action, DWORD data )\r
+HWND WINAPI\r
+HtmlHelp( HWND hwnd, LPCSTR helpFile, UINT action, DWORD_PTR data )\r
 {\r
        PROCESS_INFORMATION helpProcInfo;\r
        STARTUPINFO siStartInfo;\r
@@ -36,13 +38,13 @@ HtmlHelp( HWND hwnd, LPCSTR helpFile, UINT action, DWORD data )
        static int status = 0;\r
        FILE *f;\r
 \r
-       if(status < 0) return 0;\r
+       if(status < 0) return NULL;\r
 \r
        if(!status) {\r
                f = fopen(helpFile, "r");\r
                if(f == NULL) {\r
                        status = -1;\r
-                       return 0;\r
+                       return NULL;\r
                }\r
                status = 1;\r
                fclose(f);\r
@@ -59,10 +61,10 @@ HtmlHelp( HWND hwnd, LPCSTR helpFile, UINT action, DWORD data )
        siStartInfo.hStdOutput = NULL;\r
        siStartInfo.hStdError = debugFP;\r
 \r
-       sprintf(buf, "Hh.exe %s", helpFile);\r
+       snprintf(buf, sizeof(buf)/sizeof(buf[0]),"Hh.exe %s", helpFile);\r
 \r
        // ignore the other parameters; just start the viewer with the help file\r
-       return CreateProcess(NULL,\r
+       if(  CreateProcess(NULL,\r
                           buf,            /* command line */\r
                           NULL,           /* process security attributes */\r
                           NULL,           /* primary thread security attrs */\r
@@ -71,12 +73,13 @@ HtmlHelp( HWND hwnd, LPCSTR helpFile, UINT action, DWORD data )
                           NULL,           /* use parent's environment */\r
                           NULL,\r
                           &siStartInfo,   /* STARTUPINFO pointer */\r
-                          &helpProcInfo); /* receives PROCESS_INFORMATION */\r
+                          &helpProcInfo)  /* receives PROCESS_INFORMATION */\r
+               ) return hwnd; else return NULL;\r
 }\r
 \r
 //HWND WINAPI\r
 int\r
-MyHelp(HWND hwnd, LPSTR helpFile, UINT action, DWORD data)\r
+MyHelp(HWND hwnd, LPSTR helpFile, UINT action, DWORD_PTR data)\r
 {\r
        static int status = 0;\r
        FILE *f;\r