test: rtdeltre.c File Reference

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

# rtdeltre.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 argc, char *)
void | processargs ()
void | print (PUNICODE_STRING)
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]

## Define Documentation

#define WORK_SIZE 1024

| Definition at line 37 of file rtdeltre.c.

## Function Documentation

void Delete | ( | HANDLE | Handle | ) |

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

Definition at line 53 of file rtdeltre.c.

References Delete(), exit, L, NT_SUCCESS, NtOpenKey(), NTSTATUS(), NULL, ObjectAttributes, processargs(), WORK_SIZE, workbuffer, and WorkName.

    00057 {
    00058     NTSTATUS status;
    00059     OBJECT_ATTRIBUTES ObjectAttributes;
    00060     HANDLE          BaseHandle;
    00061
    00062     //
    00063     // Process args
    00064     //
    00065
    00066     WorkName.MaximumLength = WORK_SIZE;
    00067     WorkName.Length = 0L;
    00068     WorkName.Buffer = &(workbuffer[0]);
    00069
    00070     processargs(argc, argv);
    00071
    00072
    00073     //
    00074     // Set up and open KeyPath
    00075     //
    00076
    00077     printf("regtest3: starting\n");
    00078
    00079     InitializeObjectAttributes(
    00080         &ObjectAttributes,
    00081         &WorkName,
    00082         0,
    00083         (HANDLE)NULL,
    00084         NULL
    00085         );
    00086     ObjectAttributes.Attributes |= OBJ_CASE_INSENSITIVE;
    00087
    00088     status = NtOpenKey(
    00089                 &BaseHandle,
    00090                 DELETE | KEY_ENUMERATE_SUB_KEYS,
    00091                 &ObjectAttributes
    00092                 );
    00093     if (!NT_SUCCESS(status)) {
    00094         printf("regtest3: t0: %08lx\n", status);
    00095         exit(1);
    00096     }
    00097
    00098     Delete(BaseHandle);
    00099 }

void __cdecl main | ( | int | argc,
|  | char * |
| ) |

void print | ( | PUNICODE_STRING |  | ) |

Definition at line 313 of file rtdmp.c.

References FALSE, L, RtlUnicodeStringToAnsiString(), String, and WORK_SIZE.

    00316 {
    00317     static  ANSI_STRING temp;
    00318     static  char        tempbuffer[WORK_SIZE];
    00319
    00320     temp.MaximumLength = WORK_SIZE;
    00321     temp.Length = 0L;
    00322     temp.Buffer = tempbuffer;
    00323
    00324     RtlUnicodeStringToAnsiString(&temp, String, FALSE);
    00325     printf("%s", temp.Buffer);
    00326     return;
    00327 }

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

Definition at line 192 of file rtdeltre.c.

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

    00196 {
    00197     ANSI_STRING temp;
    00198
    00199     if ( (argc != 2) )
    00200     {
    00201         printf("Usage: %s <KeyPath>\n",
    00202                 argv[0]);
    00203         exit(1);
    00204     }
    00205
    00206     RtlInitAnsiString(
    00207         &temp,
    00208         argv[1]
    00209         );
    00210
    00211     RtlAnsiStringToUnicodeString(
    00212         &WorkName,
    00213         &temp,
    00214         TRUE
    00215         );
    00216
    00217     return;
    00218 }

void processargs | ( |  | ) |

## Variable Documentation

WCHAR workbuffer[WORK_SIZE]

| Definition at line 50 of file rtdeltre.c.

UNICODE_STRING WorkName

| Definition at line 49 of file rtdeltre.c.