Windows: no longer use WinExec in afscreds
authorJeffrey Altman <jaltman@secure-endpoints.com>
Thu, 22 Oct 2009 14:27:41 +0000 (10:27 -0400)
committerJeffrey Altman <jaltman|account-1000011@unknown>
Thu, 22 Oct 2009 14:30:23 +0000 (07:30 -0700)
WinExec is a compatibility interface for 16-bit applications.
It is not compatible with Windows 7.  Replace it with ShellExecuteEx.

LICENSE MIT

Reviewed-on: http://gerrit.openafs.org/714
Tested-by: Jeffrey Altman <jaltman@openafs.org>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>

src/WINNT/client_creds/advtab.cpp
src/WINNT/client_creds/main.cpp
src/WINNT/client_creds/shortcut.cpp

index 58256f9..ee208ab 100644 (file)
@@ -9,6 +9,8 @@
 
 #include <winsock2.h>
 #include <ws2tcpip.h>
+#include <windows.h>
+#include <shellapi.h>
 
 extern "C" {
 #include <afs/param.h>
@@ -289,7 +291,14 @@ void Advanced_OnChangeService (HWND hDlg, WORD wCmd)
 
 void Advanced_OnOpenCPL (HWND hDlg)
 {
-   WinExec ("afs_config.exe", SW_SHOW);
+    SHELLEXECUTEINFO shellExecInfo;
+
+    memset(&shellExecInfo, 0, sizeof(shellExecInfo));
+    shellExecInfo.cbSize = sizeof(shellExecInfo);
+    shellExecInfo.nShow = SW_SHOWNORMAL;
+    shellExecInfo.hwnd = hDlg;
+    shellExecInfo.lpFile = "afs_config.exe";
+    ShellExecuteEx(&shellExecInfo);
 }
 
 
index 26b598e..db8cc80 100644 (file)
@@ -68,6 +68,7 @@ extern "C" int WINAPI WinMain (HINSTANCE hInst, HINSTANCE hPrev, LPSTR pCmdLine,
    osi_LogEvent0("AFSCreds Main command line",pCmdLine);
    fs_utils_InitMountRoot();
 
+
    if (InitApp (pCmdLine))
       {
       MSG msg;
index 3ef523a..904d9a1 100644 (file)
@@ -35,7 +35,7 @@ extern "C" {
 
 void Shortcut_Init (void)
 {
-   CoInitialize(0);
+   CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
 }