progman: start programs in correct directories

Alexandre Julliard julliard at winehq.org
Thu Oct 19 06:45:24 CDT 2006


Mikołaj Zalewski <mikolaj at zalewski.pl> writes:

> @@ -274,11 +274,17 @@ VOID PROGRAM_ExecuteProgram(HLOCAL hProg
>    LPSTR lpszCmdLine = LocalLock(program->hCmdLine);
>    LPSTR lpszWorkDir = LocalLock(program->hWorkDir);
>  
> -  /* FIXME set working directory */
> -  lpszWorkDir = lpszWorkDir;
> +  if (!SetCurrentDirectory(lpszWorkDir))
> +  {
> +    MAIN_MessageBoxIDS_s(IDS_CHDIR_ERROR_s, lpszWorkDir, IDS_ERROR,
> +      MB_ICONEXCLAMATION | MB_OK);
> +    return;
> +  }
>  
>    WinExec(lpszCmdLine, program->nCmdShow);
> -  if (Globals.bMinOnRun) CloseWindow(Globals.hMainWnd);
> +  SetCurrentDirectory(Globals.szWindowsDirectory);
> +  if (Globals.bMinOnRun)
> +    CloseWindow(Globals.hMainWnd);

It would be nicer to call CreateProcess with the correct directory
argument instead of changing the current dir in the parent.

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list