Click here to Skip to main content
15,892,072 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Problem In Printing Pin
Mark Salsbery15-Mar-07 7:28
Mark Salsbery15-Mar-07 7:28 
GeneralRe: Problem In Printing Pin
Neptunex16-Mar-07 21:56
Neptunex16-Mar-07 21:56 
GeneralRe: Problem In Printing Pin
Mark Salsbery17-Mar-07 8:42
Mark Salsbery17-Mar-07 8:42 
Questiontrace generation question Pin
redbones15-Mar-07 6:26
redbones15-Mar-07 6:26 
AnswerRe: trace generation question Pin
Maximilien15-Mar-07 6:39
Maximilien15-Mar-07 6:39 
AnswerRe: trace generation question Pin
led mike15-Mar-07 6:48
led mike15-Mar-07 6:48 
QuestionRe: trace generation question Pin
redbones17-Mar-07 1:36
redbones17-Mar-07 1:36 
QuestionOn Vista GetUserObjectInformation return 0 for lpnLengthNeeded... Pin
deyadav15-Mar-07 6:23
deyadav15-Mar-07 6:23 
I have a service in which i am enumarating windowstations and then all the Desktops. Then i open each desktop and get user object info to get the SID... everything is working fine on Win2000, XP but on Vista GetUserObjectInformation API returns 0 for lpnLengthNeeded which is needed to a allocated the memory

Code snippet....
HDESK hDesk = OpenDesktop(lpszDesktop, DF_ALLOWOTHERACCOUNTHOOK,TRUE, DESKTOP_ENUMERATE);
if(hDesk)
{
if(!GetUserObjectInformation(hDesk, UOI_USER_SID, NULL, 0, &dwLength))
{
if (GetLastError() != ERROR_INSUFFICIENT_BUFFER)
AtlThrowLastWin32();
}
//
//If no user is associated, the value of dwLength is zero.
//
if(dwLength)
{
PSID pSid = 0;
pSid = (PSID) HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY, dwLength);
if (pSid == NULL)
AtlThrow(E_OUTOFMEMORY);
if (!GetUserObjectInformation(hDesk, UOI_USER_SID, pSid , dwLength, &dwLength))
AtlThrowLastWin32();

char str[250];
DWORD dw = 260;
GetTextualSid(pSid,str,&dw); ///code is available in MSDN
char lpName[250];
char lpDomain[250];
SID_NAME_USE SidType;
if( !LookupAccountSid(0, pSid, lpName, &dw, lpDomain, &dw , &SidType ) )
{
dw = GetLastError();
if( dw == ERROR_NONE_MAPPED ) wsprintf(ss,"=====SID == %s ====== NAME: NONE_MAPPED",str); else
wsprintf(ss,"=====SID == %s ====== NAME: %s [%d]",str,lpName,SidType);
}
}
}
AnswerRe: On Vista GetUserObjectInformation return 0 for lpnLengthNeeded... Pin
Mark Salsbery15-Mar-07 7:45
Mark Salsbery15-Mar-07 7:45 
GeneralRe: On Vista GetUserObjectInformation return 0 for lpnLengthNeeded... Pin
deyadav15-Mar-07 9:32
deyadav15-Mar-07 9:32 
GeneralRe: On Vista GetUserObjectInformation return 0 for lpnLengthNeeded... Pin
Mark Salsbery15-Mar-07 9:36
Mark Salsbery15-Mar-07 9:36 
QuestionMDI Pin
ScotDolan15-Mar-07 6:23
ScotDolan15-Mar-07 6:23 
AnswerRe: MDI Pin
Mark Salsbery15-Mar-07 7:58
Mark Salsbery15-Mar-07 7:58 
Questionhow to call add(int i,int j) function in a mfc dll from vb application Pin
punit singh15-Mar-07 5:11
punit singh15-Mar-07 5:11 
QuestionRe: how to call add(int i,int j) function in a mfc dll from vb application Pin
David Crow15-Mar-07 5:24
David Crow15-Mar-07 5:24 
AnswerRe: how to call add(int i,int j) function in a mfc dll from vb application Pin
punit singh15-Mar-07 6:01
punit singh15-Mar-07 6:01 
GeneralRe: how to call add(int i,int j) function in a mfc dll from vb application Pin
David Crow15-Mar-07 6:07
David Crow15-Mar-07 6:07 
GeneralRe: how to call add(int i,int j) function in a mfc dll from vb application Pin
punit singh15-Mar-07 6:36
punit singh15-Mar-07 6:36 
AnswerRe: how to call add(int i,int j) function in a mfc dll from vb application Pin
Cedric Moonen15-Mar-07 5:24
Cedric Moonen15-Mar-07 5:24 
AnswerRe: how to call add(int i,int j) function in a mfc dll from vb application Pin
krmed15-Mar-07 5:37
krmed15-Mar-07 5:37 
GeneralRe: how to call add(int i,int j) function in a mfc dll from vb application Pin
punit singh15-Mar-07 5:57
punit singh15-Mar-07 5:57 
GeneralRe: how to call add(int i,int j) function in a mfc dll from vb application Pin
punit singh15-Mar-07 5:59
punit singh15-Mar-07 5:59 
GeneralRe: how to call add(int i,int j) function in a mfc dll from vb application Pin
David Crow15-Mar-07 6:11
David Crow15-Mar-07 6:11 
GeneralRe: how to call add(int i,int j) function in a mfc dll from vb application Pin
punit singh15-Mar-07 7:00
punit singh15-Mar-07 7:00 
GeneralRe: how to call add(int i,int j) function in a mfc dll from vb application Pin
David Crow15-Mar-07 7:06
David Crow15-Mar-07 7:06 

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.