Click here to Skip to main content
15,919,434 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: pls suggest Pin
krishna Vuppala27-Sep-07 0:45
krishna Vuppala27-Sep-07 0:45 
GeneralRe: pls suggest Pin
Cedric Moonen27-Sep-07 1:16
Cedric Moonen27-Sep-07 1:16 
GeneralRe: pls suggest Pin
krishna Vuppala27-Sep-07 1:53
krishna Vuppala27-Sep-07 1:53 
GeneralRe: pls suggest Pin
David Crow27-Sep-07 3:20
David Crow27-Sep-07 3:20 
Questionconvert LPARAM to CComBstr Pin
Sunil P V26-Sep-07 22:41
Sunil P V26-Sep-07 22:41 
AnswerRe: convert LPARAM to CComBstr Pin
BhawnaA27-Sep-07 1:09
BhawnaA27-Sep-07 1:09 
AnswerRe: convert LPARAM to CComBstr Pin
ShilpiP27-Sep-07 1:59
ShilpiP27-Sep-07 1:59 
QuestionShutting Down Remote PC Pin
GauranG Shah26-Sep-07 22:41
GauranG Shah26-Sep-07 22:41 
When I try to shutdown remote pc Using the followind code it gives me the error of Access denied. Can anyone tell why this is happening.

HANDLE tokenHandle = INVALID_HANDLE_VALUE;
	TOKEN_PRIVILEGES newTokenPrivileges;
	TOKEN_PRIVILEGES oldTokenPrivileges;
	DWORD oldTokenPrivilegeSize = 0;
	LUID newLuid;

	DWORD dError;
	WCHAR CompName[] =  L"node129xp.radixweb.local"; 
	
	// Get Debug Privileges for current process
	OpenProcessToken(GetCurrentProcess(), (TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY), &tokenHandle);
	 

	// Get the LUID for SE_REMOTE_SHUTDOWN_NAME
	LookupPrivilegeValue(CompName, SE_REMOTE_SHUTDOWN_NAME, &newLuid);
	

	// Setup new token privileges
	newTokenPrivileges.PrivilegeCount = 1; // We need only one privilege


	// Copy over privilege value to one which we will send to system
	memcpy(&newTokenPrivileges.Privileges[0].Luid, &newLuid, sizeof(LUID)); // The privilege to get shutdown rights


	newTokenPrivileges.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED; // Enable it !!

	
	// Adjust the process token privileges
	AdjustTokenPrivileges(tokenHandle, FALSE, &newTokenPrivileges, sizeof(TOKEN_PRIVILEGES), &oldTokenPrivileges, &oldTokenPrivilegeSize);
	

	
        if(!InitiateSystemShutdown(CompName, L"System is shutting down in 30 seconds", 30, TRUE, TRUE))
			dError = GetLastError();



QuestionRe: Shutting Down Remote PC Pin
David Crow27-Sep-07 3:28
David Crow27-Sep-07 3:28 
AnswerRe: Shutting Down Remote PC Pin
GauranG Shah27-Sep-07 4:13
GauranG Shah27-Sep-07 4:13 
QuestionRe: Shutting Down Remote PC Pin
David Crow27-Sep-07 4:25
David Crow27-Sep-07 4:25 
AnswerRe: Shutting Down Remote PC Pin
GauranG Shah27-Sep-07 21:20
GauranG Shah27-Sep-07 21:20 
QuestionRe: Shutting Down Remote PC Pin
David Crow28-Sep-07 2:22
David Crow28-Sep-07 2:22 
AnswerRe: Shutting Down Remote PC Pin
GauranG Shah28-Sep-07 2:48
GauranG Shah28-Sep-07 2:48 
QuestionRe: Shutting Down Remote PC Pin
David Crow28-Sep-07 2:53
David Crow28-Sep-07 2:53 
AnswerRe: Shutting Down Remote PC Pin
GauranG Shah28-Sep-07 3:05
GauranG Shah28-Sep-07 3:05 
GeneralRe: Shutting Down Remote PC Pin
David Crow28-Sep-07 3:11
David Crow28-Sep-07 3:11 
GeneralRe: Shutting Down Remote PC Pin
GauranG Shah28-Sep-07 3:26
GauranG Shah28-Sep-07 3:26 
QuestionRe: Shutting Down Remote PC Pin
David Crow28-Sep-07 3:47
David Crow28-Sep-07 3:47 
AnswerRe: Shutting Down Remote PC Pin
GauranG Shah28-Sep-07 4:02
GauranG Shah28-Sep-07 4:02 
QuestionRe: Shutting Down Remote PC Pin
David Crow28-Sep-07 4:17
David Crow28-Sep-07 4:17 
QuestionDLGTemplate MapDialogRect() problem Pin
prithaa26-Sep-07 21:55
prithaa26-Sep-07 21:55 
AnswerRe: DLGTemplate MapDialogRect() problem Pin
Jason Teagle26-Sep-07 22:38
Jason Teagle26-Sep-07 22:38 
AnswerRe: DLGTemplate MapDialogRect() problem Pin
Mark Salsbery27-Sep-07 5:43
Mark Salsbery27-Sep-07 5:43 
QuestionLPT Listener using thread Pin
TPN26-Sep-07 21:05
TPN26-Sep-07 21:05 

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.