Ok, what'm I doing wrong here?
If I replace szCD with NULL (telling it to use the current processes starting directory) it launches someexec.exe just fine, but that particular exec fails because of the current directory issue.
But if I use it like above it returns error 267: The directory name is invalid.
I'm assuming i'm just casting szCD (have tried with and without the trailing \) wrong or some such, but I'm thoroughly stumped, would appreciate any help.
Code:
LPTSTR szCmd;
LPCTSTR szCD;
szCmd = _tcsdup(TEXT("\"C:\\somedir\\someexec.exe\""));
szCD = (LPCTSTR)"\"C:\\somedir\\\";
CreateProcess(Null,
szCmd,
NULL, NULL, FALSE, NORMAL_PRIORITY_CLASS, NULL,
szCD,
&si,
&pi);
If I replace szCD with NULL (telling it to use the current processes starting directory) it launches someexec.exe just fine, but that particular exec fails because of the current directory issue.
But if I use it like above it returns error 267: The directory name is invalid.
I'm assuming i'm just casting szCD (have tried with and without the trailing \) wrong or some such, but I'm thoroughly stumped, would appreciate any help.