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

rtload.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]
UNICODE_STRING FileName
WCHAR FileNameBuffer [WORK_SIZE]
OBJECT_ATTRIBUTES FileAttributes
OBJECT_ATTRIBUTES KeyAttributes
RTL_RELATIVE_NAME RelativeName


Define Documentation

#define WORK_SIZE   1024
 

Definition at line 39 of file rtload.c.


Function Documentation

void __cdecl main int  argc,
char *  argv[]
 

Definition at line 55 of file rtload.c.

References exit, FileAttributes, FileName, FileNameBuffer, KeyAttributes, KeyPath, KeyPathBuffer, L, NT_SUCCESS, NtLoadKey(), NTSTATUS(), processargs(), and WORK_SIZE.

00059 { 00060 NTSTATUS status; 00061 IO_STATUS_BLOCK IoStatus; 00062 HANDLE FileHandle; 00063 HANDLE KeyHandle; 00064 00065 // 00066 // Process args 00067 // 00068 00069 KeyPath.MaximumLength = WORK_SIZE; 00070 KeyPath.Length = 0L; 00071 KeyPath.Buffer = &(KeyPathBuffer[0]); 00072 00073 FileName.MaximumLength = WORK_SIZE; 00074 FileName.Length = 0L; 00075 FileName.Buffer = &(FileNameBuffer[0]); 00076 00077 processargs(argc, argv); 00078 00079 00080 // 00081 // Set up FileName 00082 // 00083 00084 printf("rtload: starting\n"); 00085 00086 00087 status = NtLoadKey(&KeyAttributes, &FileAttributes); 00088 if (!NT_SUCCESS(status)) { 00089 printf("rtload: key load failed status = %08lx\n", status); 00090 exit(1); 00091 } else { 00092 printf("rtload: success!\n"); 00093 } 00094 00095 exit(0); 00096 }

void __cdecl main int  ,
char * 
 

void processargs int  argc,
char *  argv[]
 

Definition at line 99 of file rtload.c.

References exit, FileAttributes, FileName, KeyAttributes, KeyPath, L, NT_SUCCESS, NtOpenKey(), NTSTATUS(), NULL, RelativeName, RtlAnsiStringToUnicodeString(), RtlDosPathNameToNtPathName_U(), RtlInitAnsiString(), RtlInitUnicodeString(), Status, and TRUE.

00103 { 00104 ANSI_STRING temp; 00105 UNICODE_STRING DosFileName; 00106 HANDLE UserHandle; 00107 PWSTR FilePart; 00108 NTSTATUS Status; 00109 00110 if ( (argc != 2) && (argc != 3)) 00111 { 00112 printf("Usage: %s [ <KeyName> ] <FileName>\n", 00113 argv[0]); 00114 exit(1); 00115 } 00116 if (argc == 3) { 00117 00118 RtlInitAnsiString( 00119 &temp, 00120 argv[1] 00121 ); 00122 00123 RtlAnsiStringToUnicodeString( 00124 &KeyPath, 00125 &temp, 00126 TRUE 00127 ); 00128 00129 RtlInitAnsiString( 00130 &temp, 00131 argv[2] 00132 ); 00133 00134 RtlAnsiStringToUnicodeString( 00135 &DosFileName, 00136 &temp, 00137 TRUE 00138 ); 00139 00140 RtlDosPathNameToNtPathName_U( DosFileName.Buffer, 00141 &FileName, 00142 NULL, 00143 NULL ); 00144 00145 InitializeObjectAttributes( 00146 &FileAttributes, 00147 &FileName, 00148 OBJ_CASE_INSENSITIVE, 00149 (HANDLE)NULL, 00150 NULL 00151 ); 00152 00153 // 00154 // Set up KeyPath 00155 // 00156 00157 InitializeObjectAttributes( 00158 &KeyAttributes, 00159 &KeyPath, 00160 OBJ_CASE_INSENSITIVE, 00161 (HANDLE)NULL, 00162 NULL 00163 ); 00164 } else if (argc==2) { 00165 RtlInitAnsiString(&temp, argv[1]); 00166 RtlAnsiStringToUnicodeString(&DosFileName, &temp, TRUE); 00167 RtlDosPathNameToNtPathName_U( DosFileName.Buffer, 00168 &FileName, 00169 &FilePart, 00170 &RelativeName ); 00171 00172 InitializeObjectAttributes( &FileAttributes, 00173 &RelativeName.RelativeName, 00174 OBJ_CASE_INSENSITIVE, 00175 RelativeName.ContainingDirectory, 00176 NULL ); 00177 00178 RtlInitUnicodeString(&KeyPath, L"\\Registry\\User"); 00179 InitializeObjectAttributes( &KeyAttributes, 00180 &KeyPath, 00181 OBJ_CASE_INSENSITIVE, 00182 NULL, 00183 NULL ); 00184 Status = NtOpenKey( &UserHandle, 00185 KEY_READ, 00186 &KeyAttributes); 00187 if (!NT_SUCCESS(Status)) { 00188 printf("Couldn't open \\Registry\\User, status %08lx\n",Status); 00189 exit(1); 00190 } 00191 00192 RtlInitUnicodeString(&KeyPath, FilePart); 00193 InitializeObjectAttributes( &KeyAttributes, 00194 &KeyPath, 00195 OBJ_CASE_INSENSITIVE, 00196 UserHandle, 00197 NULL ); 00198 00199 } 00200 00201 00202 return; 00203 }

void processargs  ) 
 


Variable Documentation

OBJECT_ATTRIBUTES FileAttributes
 

Definition at line 50 of file rtload.c.

Referenced by IoCreateFile(), main(), NtCreateFile(), processargs(), and ZwCreateFile().

UNICODE_STRING FileName
 

Definition at line 47 of file rtload.c.

Referenced by BuildQueryDirectoryIrp(), CcLogError(), CmpAddDriverToList(), CmpInitHiveFromFile(), CmpInitializeHive(), CmpInitializeHiveList(), CmpNameFromAttributes(), CmpWorker(), CmpWorkerCommand(), ColorSpaceControl(), CreateCRDControl(), CreateINTENTControl(), DbgkCreateThread(), DbgkpSectionHandleToFileHandle(), DebugLoadImageSymbols(), DebugUnLoadImageSymbols(), EhOpenHive(), FsRtlNotifyFullReportChange(), FsRtlNotifyUpdateBuffer(), HvInitializeHive(), HvpFillFileName(), IopOpenLinkOrRenameTarget(), IopQueryName(), main(), MiMapViewOfImageSection(), MmGetFileNameForSection(), MyCmpInitHiveFromFile(), NtLoadKey2(), NtQueryDirectoryFile(), NtSetInformationFile(), ParseArgs(), poolDumpHive(), processargs(), RegLoadAsciiFileAsUnicode(), RegReadBinaryFile(), RegReadMultiSzFile(), RiInitializeRegistryFromAsciiFile(), RtlAssert(), RtlDoesFileExists_U(), RtlDoesFileExists_UEx(), RtlGetFullPathName_Ustr(), ScanHive(), UdfCommonCreate(), UdfGenerate8dot3Name(), UdfInitializeEnumeration(), UdfIs8dot3Name(), UdfNormalizeFileNames(), UdfQueryDirectory(), and VdmQueryDirectoryFile().

WCHAR FileNameBuffer[WORK_SIZE]
 

Definition at line 48 of file rtload.c.

Referenced by main(), and RegReadBinaryFile().

OBJECT_ATTRIBUTES KeyAttributes
 

Definition at line 51 of file rtload.c.

Referenced by main(), OpenKeyboardLayoutFile(), and processargs().

UNICODE_STRING KeyPath
 

Definition at line 44 of file rtload.c.

WCHAR KeyPathBuffer[WORK_SIZE]
 

Definition at line 45 of file rtload.c.

Referenced by LdrQueryImageFileExecutionOptions(), main(), and RtlpGetRegistryHandle().

RTL_RELATIVE_NAME RelativeName
 

Definition at line 52 of file rtload.c.

Referenced by LdrLoadAlternateResourceModule(), processargs(), RtlDoesFileExists_UEx(), RtlDosPathNameToNtPathName_U(), and RtlpWin32NTNameToNtPathName_U().


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