Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

rtunload.c File Reference

#include <nt.h>
#include <ntrtl.h>
#include <nturtl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

Go to the source code of this file.

Defines

#define WORK_SIZE   1024

Functions

void __cdecl main (int, char *)
void processargs ()
void __cdecl main (int argc, char *argv[])
void processargs (int argc, char *argv[])

Variables

UNICODE_STRING KeyPath
WCHAR KeyPathBuffer [WORK_SIZE]


Define Documentation

#define WORK_SIZE   1024
 

Definition at line 36 of file rtunload.c.


Function Documentation

void __cdecl main int  argc,
char *  argv[]
 

Definition at line 45 of file rtunload.c.

References exit, FALSE, KeyAttributes, KeyPath, KeyPathBuffer, L, NT_SUCCESS, NTSTATUS(), NtUnloadKey(), NULL, processargs(), RtlAdjustPrivilege(), TRUE, and WORK_SIZE.

00049 { 00050 NTSTATUS status; 00051 OBJECT_ATTRIBUTES KeyAttributes; 00052 IO_STATUS_BLOCK IoStatus; 00053 HANDLE FileHandle; 00054 HANDLE KeyHandle; 00055 BOOLEAN WasEnabled; 00056 00057 // 00058 // Process args 00059 // 00060 00061 KeyPath.MaximumLength = WORK_SIZE; 00062 KeyPath.Length = 0L; 00063 KeyPath.Buffer = &(KeyPathBuffer[0]); 00064 00065 processargs(argc, argv); 00066 00067 00068 printf("rtunload: starting\n"); 00069 00070 RtlAdjustPrivilege(SE_RESTORE_PRIVILEGE, TRUE, FALSE, &WasEnabled); 00071 // 00072 // Set up KeyPath 00073 // 00074 00075 InitializeObjectAttributes( 00076 &KeyAttributes, 00077 &KeyPath, 00078 OBJ_CASE_INSENSITIVE, 00079 (HANDLE)NULL, 00080 NULL 00081 ); 00082 00083 status = NtUnloadKey(&KeyAttributes); 00084 00085 RtlAdjustPrivilege(SE_RESTORE_PRIVILEGE, WasEnabled, FALSE, &WasEnabled); 00086 00087 if (!NT_SUCCESS(status)) { 00088 printf("rtunload: key unload failed status = %08lx\n", status); 00089 exit(1); 00090 } else { 00091 printf("rtunload: success!\n"); 00092 } 00093 00094 exit(0); 00095 }

void __cdecl main int  ,
char * 
 

void processargs int  argc,
char *  argv[]
 

Definition at line 98 of file rtunload.c.

References exit, KeyPath, RtlAnsiStringToUnicodeString(), RtlInitAnsiString(), and TRUE.

00102 { 00103 ANSI_STRING temp; 00104 00105 if ( (argc != 2) ) 00106 { 00107 printf("Usage: %s <KeyName>\n", 00108 argv[0]); 00109 exit(1); 00110 } 00111 00112 RtlInitAnsiString( 00113 &temp, 00114 argv[1] 00115 ); 00116 00117 RtlAnsiStringToUnicodeString( 00118 &KeyPath, 00119 &temp, 00120 TRUE 00121 ); 00122 00123 return; 00124 }

void processargs  ) 
 


Variable Documentation

UNICODE_STRING KeyPath
 

Definition at line 41 of file rtunload.c.

WCHAR KeyPathBuffer[WORK_SIZE]
 

Definition at line 42 of file rtunload.c.


Generated on Sat May 15 19:45:30 2004 for test by doxygen 1.3.7