Command line CreateProcess-executed executed on WinXP but don't be executed on Win7 and Win8

156 views Asked by At

I am using cwRsync under Windows to synchronize directories. I call it via command line in Visual C++ code (Visual Sudio 2008). I use CreateProcess() function to execute it. TROUBLE: On Windows XP, the synchronisation works. On Windows 7 and 8, the synchronisation doesn't operate. When I directly test the command line under cmd.exe it works.

What is the problem of CreateProcess inside Windows 7 and 8? There is no error message because the function returns OK.

Koto

1

There are 1 answers

0
Koto On

I found the solution. The trouble is about my use of CreateProcess() which works in XP but not in Win7

BOOL WINAPI CreateProcess(
  _In_opt_     LPCTSTR lpApplicationName,
  _Inout_opt_  LPTSTR lpCommandLine,
  _In_opt_     LPSECURITY_ATTRIBUTES lpProcessAttributes,
  _In_opt_     LPSECURITY_ATTRIBUTES lpThreadAttributes,
  _In_         BOOL bInheritHandles,
  _In_         DWORD dwCreationFlags,
  _In_opt_     LPVOID lpEnvironment,
  _In_opt_     LPCTSTR lpCurrentDirectory,
  _In_         LPSTARTUPINFO lpStartupInfo,
  _Out_        LPPROCESS_INFORMATION lpProcessInformation
);

Before :

lpApplicationName = NULL

lpCommandLine = C:\cwRsync\rsync.exe --recursive /cygdrive/d/documents/ /cygdrive/f/documents/

Windows XP => OK but Windows 7 => KO

Now :

lpaApplicationName = C:\cwRsync\rsync.exe

lpCommandLine = --recursive /cygdrive/d/documents/ /cygdrive/f/documents/

Windows XP => OK and Windows 7 => OK too