Click here to Skip to main content
15,914,642 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Copy the *.exe which built with VC to the other computer but it doesn't work Pin
Rane31-Aug-08 20:50
Rane31-Aug-08 20:50 
QuestionCreateFile Access Pin
Bram van Kampen29-Aug-08 12:37
Bram van Kampen29-Aug-08 12:37 
AnswerRe: CreateFile Access Pin
Mark Salsbery29-Aug-08 13:58
Mark Salsbery29-Aug-08 13:58 
GeneralRe: CreateFile Access Pin
Bram van Kampen31-Aug-08 14:33
Bram van Kampen31-Aug-08 14:33 
QuestionHow to read the Computer SID? Pin
StefanKittel29-Aug-08 12:19
StefanKittel29-Aug-08 12:19 
AnswerRe: How to read the Computer SID? Pin
Mark Salsbery29-Aug-08 12:48
Mark Salsbery29-Aug-08 12:48 
GeneralRe: How to read the Computer SID? Pin
StefanKittel29-Aug-08 13:03
StefanKittel29-Aug-08 13:03 
GeneralRe: How to read the Computer SID? [modified] Pin
Mark Salsbery29-Aug-08 13:25
Mark Salsbery29-Aug-08 13:25 
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);

//... use the SID (psid) here ...

// ** Test **
LPTSTR StringSid;
::ConvertSidToStringSid(psid, &StringSid);
::LocalFree(StringSid);
// ** End Test **

delete[] domain;
delete[] (BYTE*)psid;


Mark Salsbery
Microsoft MVP - Visual C++

Java | [Coffee]

modified on Saturday, August 30, 2008 11:45

GeneralRe: How to read the Computer SID? Pin
StefanKittel30-Aug-08 1:36
StefanKittel30-Aug-08 1:36 
QuestionCInternetfile - trying to use 'seek' always getting an assertion error Pin
simon alec smith29-Aug-08 10:10
simon alec smith29-Aug-08 10:10 
QuestionRe: CInternetfile - trying to use 'seek' always getting an assertion error Pin
David Crow29-Aug-08 10:35
David Crow29-Aug-08 10:35 
AnswerRe: CInternetfile - trying to use 'seek' always getting an assertion error Pin
simon alec smith29-Aug-08 10:37
simon alec smith29-Aug-08 10:37 
QuestionRe: CInternetfile - trying to use 'seek' always getting an assertion error Pin
David Crow29-Aug-08 10:40
David Crow29-Aug-08 10:40 
AnswerRe: CInternetfile - trying to use 'seek' always getting an assertion error Pin
simon alec smith29-Aug-08 10:46
simon alec smith29-Aug-08 10:46 
QuestionRe: CInternetfile - trying to use 'seek' always getting an assertion error Pin
David Crow29-Aug-08 10:47
David Crow29-Aug-08 10:47 
AnswerRe: CInternetfile - trying to use 'seek' always getting an assertion error Pin
simon alec smith29-Aug-08 10:58
simon alec smith29-Aug-08 10:58 
QuestionRe: CInternetfile - trying to use 'seek' always getting an assertion error Pin
David Crow29-Aug-08 11:02
David Crow29-Aug-08 11:02 
AnswerRe: CInternetfile - trying to use 'seek' always getting an assertion error Pin
simon alec smith29-Aug-08 11:07
simon alec smith29-Aug-08 11:07 
AnswerRe: CInternetfile - trying to use 'seek' always getting an assertion error Pin
simon alec smith29-Aug-08 11:19
simon alec smith29-Aug-08 11:19 
GeneralRe: CInternetfile - trying to use 'seek' always getting an assertion error Pin
Mark Salsbery29-Aug-08 11:28
Mark Salsbery29-Aug-08 11:28 
QuestionUnable to send AT commands to the COM3 port. plz help. Pin
AprNgp29-Aug-08 6:34
AprNgp29-Aug-08 6:34 
QuestionRe: Unable to send AT commands to the COM3 port. plz help. Pin
Perspx29-Aug-08 6:50
Perspx29-Aug-08 6:50 
AnswerRe: Unable to send AT commands to the COM3 port. plz help. Pin
AprNgp29-Aug-08 6:52
AprNgp29-Aug-08 6:52 
GeneralRe: Unable to send AT commands to the COM3 port. plz help. Pin
AprNgp29-Aug-08 6:58
AprNgp29-Aug-08 6:58 
GeneralRe: Unable to send AT commands to the COM3 port. plz help. [modified] Pin
SandipG 29-Aug-08 8:22
SandipG 29-Aug-08 8:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.