Skip to content

Commit

Permalink
CreateProcess needs a non-const cmdLine input
Browse files Browse the repository at this point in the history
  • Loading branch information
bonsaiviking committed Apr 19, 2018
1 parent 60f34c4 commit 7f7c7ab
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packetWin7/NPFInstall/NPFInstall/DriverStoreClear.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,11 @@ BOOLEAN ClearDriverStore()
{
TRACE_ENTER();

tstring cmd = executeCommand(_T("pnputil.exe -e"));
TCHAR renameCmd[16+MAX_PATH] = _T("pnputil.exe -e");
// "pnputil.exe -d oem1.inf"
tstring cmd = executeCommand(renameCmd);
vector<tstring> nInfFileNameList = getInfNamesFromPnpUtilOutput(cmd);

TCHAR renameCmd[MAX_PATH];
// "pnputil.exe -d oem1.inf"
for (size_t i = 0; i < nInfFileNameList.size(); i++)
{
Expand Down
3 changes: 3 additions & 0 deletions packetWin7/NPFInstall/NPFInstall/ProcessUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,10 @@ BOOL killProcess_Soft(DWORD dwProcessID)
tstring strCommand = _T("taskkill /pid ");
strCommand += itos(dwProcessID);

TCHAR* cmdLine = new TCHAR[strCommand.length() * sizeof(TCHAR)];
_tcscpy_s(cmdLine, strCommand.length(), (TCHAR*)strCommand.c_str());
tstring strResult = executeCommand((TCHAR*)strCommand.c_str());
delete[] cmdLine;

if (_tcsncmp(strResult.c_str(), _T("SUCCESS"), _tcslen(_T("SUCCESS"))) == 0)
{
Expand Down

0 comments on commit 7f7c7ab

Please sign in to comment.