|
From what I can find, the last 96 bits of
HKEY_LOCAL_MACHINE\SECURITY\SAM\Domains\Account\V
is the machine SID.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hello,
on my computer Vista, no domain, the hive \\hklm\security is complete empty
\\hklm\sam\sam is empty too
Stefan
|
|
|
|
|
You have to enable viewing - by default (even if you're
an administrator), you don't have read rights in the security
key. You can give yourself permissions in regedit however.
Anyway, I played around with this, and the following code
gives me the same SID found in that registry hive (on Vista):
DWORD SIDLength = 0;
DWORD RefDomainNameLength = 0;
SID_NAME_USE SIDNameUse;
::LookupAccountName(NULL, _T("MYCOMPUTERNAME\\"), NULL, &SIDLength, NULL, &RefDomainNameLength, &SIDNameUse);
PSID psid = (PSID)new BYTE[SIDLength];
LPTSTR domain = new TCHAR[RefDomainNameLength];
::LookupAccountName(NULL, _T("MYCOMPUTERNAME\\"), psid, &SIDLength, domain, &RefDomainNameLength, &SIDNameUse);
LPTSTR StringSid;
::ConvertSidToStringSid(psid, &StringSid);
::LocalFree(StringSid);
delete[] domain;
delete[] (BYTE*)psid;
Mark Salsbery
Microsoft MVP - Visual C++
modified on Saturday, August 30, 2008 11:45
|
|
|
|
|
Hello,
that looks great. I ignored LookupAccountName because, reading in the msdn, it should be only working with a PDC.
I try this out.
Thanks
Stefan
|
|
|
|
|
Can any body help?
I can successfuly write to the file,
but if I try to append it using the seek,
nomatter what parameters I pass, I always
get an assertion error.
my only soloution is to load the file contents
and then rewrite it fresh again, to get it working
oh dear, what a waste of resources, also my concern is,
from reading it and then writing it in this manor
if a number of users who use my software, there might be a chance
that when writing some recorded information will be lost
due to this manor
but my reckoning is that the file access spped is so fast
anyway that this shouldn't really matter. or does it?
looking for your expert opinion,
thanks
simon
|
|
|
|
|
simon alec smith wrote: ...I always
get an assertion error.
What line of what file is asserting?
"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
|
|
|
|
|
inet.cpp
line 918
yellow arrow pointed to ----> ASSERT(m_bReadMode);
|
|
|
|
|
So have you looked at line 918 of inet.cpp to see what condition is asserting?
"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
|
|
|
|
|
ASSERT(m_bReadMode);
I have no clue at all whats this line is doing
|
|
|
|
|
It is asserting that m_bReadMode is non-zero. Apparently it is not. How are you constructing the CInternetFile object?
"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
|
|
|
|
|
CInternetFile* pFile = (CInternetFile *)m_pFtpConnection->OpenFile("simon.txt", GENERIC_WRITE, FTP_TRANSFER_TYPE_ASCII);
|
|
|
|
|
Why the unnecessary cast?
Have you stepped into either of the CInternetFile constructors to see what m_bReadMode is being set to?
"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
|
|
|
|
|
Hi, Dave
I am quite fresh at this, how do I go about stepping into the
CInternetfile section
cheers
|
|
|
|
|
LONG CInternetFile::Seek(LONG lOffset, UINT nFrom)
{
ASSERT_VALID(this);
ASSERT(m_hFile != NULL);
ASSERT(m_bReadMode);
ASSERT(m_pbReadBuffer == NULL);
// can't do this on a file for writing
// can't do this on a file that's got a buffer
//////////////the above mentioned/////
Is there an alternative
|
|
|
|
|
Also, asserting on m_bReadMode==false indicates that the code
requires read mode - you specify GENERIC_WRITE.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I have configured the COM3 (modem) port with the help of CreateFile() function.
But when i m using the WriteFile() function to send the AT command strings to them modem, its not working ... i mean nothing is happening ....
plz help...
how to send a string to a port ... ?
Apurv
|
|
|
|
|
Does WriteFile() fail or succeed?
Regards,
--Perspx
"The Blue Screen of Death, also known as The Blue Screen of Doom, the "Blue Screen of Fun", "Phatul Exception: The WRECKening" and "Windows Vista", is a multi award-winning game first developed in 1995 by Microsoft" - Uncyclopedia
Introduction to Object-Oriented JavaScript
|
|
|
|
|
WriteFile() succeeds ....
Apurv
|
|
|
|
|
my code is as follows ...
DCB dcb;
HANDLE hCom;
BOOL fSuccess;
TCHAR *pcCommPort = TEXT("COM3");
char DataBuffer[] = "AT+FCLASS=8";
DWORD dwBytesToWrite = (DWORD)strlen(DataBuffer);
char Data2[]="ATDW2289759";
DWORD dwBytesWritten = 0;
DWORD dwBytesRead = 0;
char ReadBuffer[BUFFER_SIZE] = {0};
hCom = CreateFile( pcCommPort,
GENERIC_READ | GENERIC_WRITE,
0,
NULL,
OPEN_EXISTING,
0,
NULL
);
if (hCom == INVALID_HANDLE_VALUE)
{
printf ("CreateFile failed with error %d.\n", GetLastError());
return (1);
}
dcb.DCBlength = sizeof(DCB);
fSuccess = GetCommState(hCom, &dcb);
if (!fSuccess)
{
printf ("GetCommState failed with error %d.\n", GetLastError());
return (2);
}
dcb.BaudRate = CBR_2400;
dcb.ByteSize = 8;
dcb.Parity = NOPARITY;
dcb.StopBits = ONESTOPBIT;
fSuccess = SetCommState(hCom, &dcb);
if (!fSuccess)
{
printf ("SetCommState failed with error %d.\n", GetLastError());
return (3);
}
_tprintf (TEXT("Serial port %s successfully reconfigured.\n"),pcCommPort);
if( FALSE == WriteFile(hCom,
DataBuffer + dwBytesWritten,
dwBytesToWrite - dwBytesWritten,
&dwBytesWritten,
NULL))
printf("Could not write %s to file (error %d)\n",DataBuffer, GetLastError());
else
_tprintf(TEXT("Wrote %d bytes successfully.\n"), dwBytesWritten);
if( FALSE == ReadFile(hCom, ReadBuffer, BUFFER_SIZE-2, &dwBytesRead, NULL) )
{
printf("Could not read from file (error %d)\n", GetLastError());
}
else
printf("%s",ReadBuffer);
dwBytesWritten = 0;
if( FALSE == WriteFile(hCom,
Data2 + dwBytesWritten,
(DWORD)sizeof(Data2) - dwBytesWritten,
&dwBytesWritten,
NULL))
printf("Could not write %s to file (error %d)\n",Data2, GetLastError());
else
_tprintf(TEXT("Wrote %d bytes successfully.\n"), dwBytesWritten);
if( FALSE == ReadFile(hCom, ReadBuffer, BUFFER_SIZE-2, &dwBytesRead, NULL) )
{
printf("Could not read from file (error %d)\n", GetLastError());
}
else
printf("%s",ReadBuffer);
after sending the string to the port, i m reading the port, and every time same string is read !
Apurv
|
|
|
|
|
Probably you are communicating with some mobile or modem. Append \r\n at the end of every AT Command. Then only you will get the response from the device.
Regards,
Sandip.
modified on Friday, August 29, 2008 2:32 PM
|
|
|
|
|
STILL no call is made by the modem, even though same commands are working well with HyperTerminal ...
what shall i do ?
Apurv
|
|
|
|
|
you are reading as soon as you write try adding some sleep in between write and read.
I hope it will help you. But don't forget to add "\r\n" may be you can try "\n\r" i am not sure about the exact order.
Regards,
Sandip.
|
|
|
|
|
i have tried
Sleep(1000*10);
and
Sleep(1000*20);
the o/p of reading is the earlier command + OK (in the next line)
Apurv
|
|
|
|
|
OK is nothing but response from the modem.
what is not working then for you???
Regards,
Sandip.
|
|
|
|
|
it is not dialing the number i provided ....
ATDW2289759\r\n
Apurv
|
|
|
|
|