|
Hi all,
I am getting an error here which usually does not happen.
I am getting
Unhandled exception at 0x77ddd83e in UpdateService.exe: 0xC0000005: Access violation reading location 0x00c7913e.
the values are:
hKey {unused=??? } HKEY__ *
lpValueName 0x004b9198 "Installer" const wchar_t *
Reserved 0 unsigned long
dwType 1 unsigned long
lpData "R" const unsigned char *
cbData 520 unsigned long
I wonder why it crashes as I use the same thing to my other inputs it does not happen. the code is this:
RMRegSetValueEx(hkey,UPDATELINK,0,REG_SZ,(BYTE*)((*Iter)->link.c_str()),_MAX_PATH);
RMRegSetValueEx(hkey,UPDATEFILE,0,REG_SZ,(BYTE*)(*Iter)->savePath.c_str(),_MAX_PATH);
RMRegSetValueEx(hkey,UPDATEINSTALL,0,REG_SZ,(BYTE*)(*Iter)->nameVer.c_str(),_MAX_PATH);
LONG RMRegSetValueEx(
HKEY hKey,
LPCTSTR lpValueName,
DWORD Reserved,
DWORD dwType,
CONST BYTE *lpData,
DWORD cbData
)
{
do
{
if (lRegOperLastErr == 1450)
{
Sleep(100);
}
lRegOperLastErr = RegSetValueEx(
hKey,
lpValueName,
Reserved,
dwType,
lpData,
cbData
);
} while (lRegOperLastErr == 1450);
return lRegOperLastErr;
}
At the bold part where the crashing happens at only one time at a specific value, that is being used with other values but does not crash.
Please advise
thanks,
Jayjay
|
|
|
|
|
monsieur_jj wrote: At the bold part where the crashing happens at only one time at a specific value,
What is that specific value that you are passing in?
Regards,
Rane
|
|
|
|
|
Hi Rane,
RMRegSetValueEx(hkey,UPDATEINSTALL,0,REG_SZ,(BYTE*)(*Iter)->nameVer.c_str(),_MAX_PATH);
the UPDATEINSTALL = _T("Installer")
nameVer = "Re-Rite Asian 6.0.0.125"
_MAX_PATH = 260
Is that all you need?
Thanks,
Jayjay
|
|
|
|
|
Why can't you use FormatMessage function to get a generic description of the error?
Regards,
Rane
|
|
|
|
|
Why are you passing _MAX_PATH instead of the actual size (in bytes) of the string?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
If RegSetValueEx() is failing, why are you not calling GetLastError() ?
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Can anybody suggest me a method for geting the Ip address of the computer.
Thanks in advance
With Regards
Deepu
|
|
|
|
|
void GetHostIP()
{
char *Ip;
WSADATA wsaData;
struct hostent *pHostEnt;
struct sockaddr_in tmpSockAddr;
WSAStartup(MAKEWORD(2,0),&wsaData);
char hostname[25];
strcpy(hostname,"Test Computer Name")
pHostEnt = gethostbyname(hostname);
if(pHostEnt == NULL)
{
printf("Error occured: %s\n",GetLastError());
return;
}
memcpy(&tmpSockAddr.sin_addr,pHostEnt->h_addr,pHostEnt->h_length);
Ip = NULL;
Ip = new char[17];
strcpy(Ip,inet_ntoa(tmpSockAddr.sin_addr));
printf("Ip Address of the machine %s is %s\n",Ip);
WSACleanup();
delete [] Ip;
}
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Please tell me the header files to be included.
|
|
|
|
|
Use gethostbyname function...
Regards,
Rane
|
|
|
|
|
Can u tell me the header files to be included.
It is showing as "undeclared identifier".
|
|
|
|
|
Documentation Check here [^]
Regards,
Sandip.
|
|
|
|
|
Hi all
How can make a application which run program as a system service? Plz help me
|
|
|
|
|
Check out this link.[^]
Regards,
Rane
|
|
|
|
|
Services[^]
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi all,
i m using CListCtrl wit LVS_SHOWSELALWAYS and LVS_EX_FULLROWSELECT property.
here multiple items are select with the help of mouse.
i want only one row select at any condition.
please tell me how can i do this.
if possible please explain with example.
i waiting for your valuable suggestion and replies.
thanks in advance.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
One way would be to handle the click event on the list. Save the index of the selected item in some member variable. Once the user clicks on an item other than the selected one use SetItemState and SetSelectionMark to get this done. You already have the previously selected item index stored and can get the current one easily
Hope this helps
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
"_$h@nky_" wrote: i want only one row select at any condition.
set the LVS_SINGLESEL style.
|
|
|
|
|
thanks.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
Hello dear friends,
How can I get the all drive name of PC?
|
|
|
|
|
is _getdrive() helpful?
From MSDN:
int main( void )
{
int ch, drive, curdrive;
static char path[_MAX_PATH];
curdrive = _getdrive();
printf( "Available drives are:\n" );
for( drive = 1; drive <= 26; drive++ )
{
if( !_chdrive( drive ) )
{
printf( "%c:", drive + 'A' - 1 );
if( _getdcwd( drive, path, _MAX_PATH ) != NULL )
printf( " (Current directory is %s)", path );
putchar( '\n' );
}
}
_chdrive( curdrive );
}
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Thx's _AnShUmAn_
It's working..
Now i want to add these drive name in edit box then i am geting some problem.When i am adding these drive name in edit box then first and last name is added.Middle one is skip..i am useing this code
GetDlgItemText(IDC_EDIT_DIR_TO_MONITOR,m_strDirectoryToMonitor);
if(m_strDirectoryToMonitor.Trim().IsEmpty())
{
SetDlgItemText(IDC_EDIT_DIR_TO_MONITOR,b);
}
else if(!m_strDirectoryToMonitor.Trim().IsEmpty())
{
SetDlgItemText(IDC_EDIT_DIR_TO_MONITOR2,b);
}
plz help me
|
|
|
|
|
|
JFYI- you can ignore this statement [if(!m_strDirectoryToMonitor.Trim().IsEmpty())]. It doesn't server the purpose, since if the string is empty it would be processed in the if part otherwise the else part...
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Use GetLogicalDriveStrings()
|
|
|
|