Re: After recalling same Function get GetLastError = 1008

Tech-Archive recommends: Fix windows errors by optimizing your registry



"Martin Vuille" <jpmv27@xxxxxxxxx> schrieb im Newsbeitrag
news:Xns9901639013B0Ejpmvrealtime@xxxxxxxxxxxxxxxxxx
"Kerem Gümrükcü" <kareem114@xxxxxxxxxxx> wrote in
news:ebh715TcHHA.3408@xxxxxxxxxxxxxxxxxxxx:


sFullCommand = sCMD + " " + sCommandLine;
lpszCommand = new TCHAR[sFullCommand.GetLength()+1];

if(this->m_StartWithOutputRedirection == TRUE){
sFullCommand += " > \"";
sFullCommand += lpszDesktopPath;
sFullCommand += "chkdsk result ";
sFullCommand += sTimeForLogFile + ".txt";
sFullCommand += "\"";

}

_tcscpy(lpszCommand,sFullCommand);


Shouldn't you allocate lpszCommand _after_ you have appended
the output redirection to sFullCommand?

As it stands, you don't allocate enough space in the buffer,
which is quite likely to cause "Exceptional" behaviour.

MV

Hi Martin,

you are my Hero!
I was about to become crazy.
But why did i get such a "wrong" last error code?


Best regards

Kerem Gümrükcü


.