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

rtrenval.c File Reference

#include "cmp.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 Delete (HANDLE Handle)
void __cdecl main (int argc, char *argv[])
void processargs (int argc, char *argv[])

Variables

UNICODE_STRING WorkName
WCHAR workbuffer [WORK_SIZE]
UNICODE_STRING ValueName
WCHAR valuebuffer [WORK_SIZE]
UNICODE_STRING NewValueName
WCHAR newvaluebuffer [WORK_SIZE]


Define Documentation

#define WORK_SIZE   1024
 

Definition at line 34 of file rtrenval.c.


Function Documentation

void Delete HANDLE  Handle  ) 
 

Referenced by Delete(), and main().

void __cdecl main int  argc,
char *  argv[]
 

Definition at line 54 of file rtrenval.c.

References exit, L, newvaluebuffer, NewValueName, NT_SUCCESS, NtClose(), NtOpenKey(), NTSTATUS(), NULL, ObjectAttributes, processargs(), valuebuffer, ValueName, WORK_SIZE, workbuffer, and WorkName.

00058 { 00059 NTSTATUS status; 00060 OBJECT_ATTRIBUTES ObjectAttributes; 00061 HANDLE BaseHandle; 00062 00063 // 00064 // Process args 00065 // 00066 00067 WorkName.MaximumLength = WORK_SIZE; 00068 WorkName.Length = 0L; 00069 WorkName.Buffer = &(workbuffer[0]); 00070 00071 00072 ValueName.MaximumLength = WORK_SIZE; 00073 ValueName.Length = 0L; 00074 ValueName.Buffer = &(valuebuffer[0]); 00075 00076 NewValueName.MaximumLength = WORK_SIZE; 00077 NewValueName.Length = 0L; 00078 NewValueName.Buffer = &(newvaluebuffer[0]); 00079 00080 processargs(argc, argv); 00081 00082 00083 // 00084 // Set up and open KeyPath 00085 // 00086 printf("rtrenval: starting\n"); 00087 00088 InitializeObjectAttributes( 00089 &ObjectAttributes, 00090 &WorkName, 00091 0, 00092 (HANDLE)NULL, 00093 NULL 00094 ); 00095 ObjectAttributes.Attributes |= OBJ_CASE_INSENSITIVE; 00096 00097 status = NtOpenKey( 00098 &BaseHandle, 00099 KEY_SET_VALUE, 00100 &ObjectAttributes 00101 ); 00102 if (!NT_SUCCESS(status)) { 00103 printf("rtrenval: t0: %08lx\n", status); 00104 exit(1); 00105 } 00106 00107 NtRenameValueKey( 00108 BaseHandle, 00109 &ValueName, 00110 &NewValueName, 00111 42 00112 ); 00113 00114 if (!NT_SUCCESS(status)) { 00115 printf("rtrenval: t1: %08lx\n", status); 00116 exit(1); 00117 } 00118 00119 NtClose(BaseHandle); 00120 exit(0); 00121 }

void __cdecl main int  ,
char * 
 

void processargs int  argc,
char *  argv[]
 

Definition at line 124 of file rtrenval.c.

References exit, NewValueName, RtlAnsiStringToUnicodeString(), RtlInitAnsiString(), TRUE, ValueName, and WorkName.

00128 { 00129 ANSI_STRING temp; 00130 00131 if ( (argc != 4) ) 00132 { 00133 printf("Usage: %s <KeyPath> <old value entry name> <new value entry name>\n", 00134 argv[0]); 00135 exit(1); 00136 } 00137 00138 RtlInitAnsiString( 00139 &temp, 00140 argv[1] 00141 ); 00142 00143 RtlAnsiStringToUnicodeString( 00144 &WorkName, 00145 &temp, 00146 TRUE 00147 ); 00148 00149 RtlInitAnsiString( 00150 &temp, 00151 argv[2] 00152 ); 00153 00154 RtlAnsiStringToUnicodeString( 00155 &ValueName, 00156 &temp, 00157 TRUE 00158 ); 00159 00160 RtlInitAnsiString( 00161 &temp, 00162 argv[3] 00163 ); 00164 00165 RtlAnsiStringToUnicodeString( 00166 &NewValueName, 00167 &temp, 00168 TRUE 00169 ); 00170 00171 return; 00172 }

void processargs  ) 
 


Variable Documentation

WCHAR newvaluebuffer[WORK_SIZE]
 

Definition at line 51 of file rtrenval.c.

Referenced by main().

UNICODE_STRING NewValueName
 

Definition at line 50 of file rtrenval.c.

Referenced by main(), and processargs().

WCHAR valuebuffer[WORK_SIZE]
 

Definition at line 48 of file rtrenval.c.

UNICODE_STRING ValueName
 

Definition at line 47 of file rtrenval.c.

WCHAR workbuffer[WORK_SIZE]
 

Definition at line 45 of file rtrenval.c.

UNICODE_STRING WorkName
 

Definition at line 44 of file rtrenval.c.


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