VOID FatMain( IN ULONG LoopCount, IN CHAR Device[] ) { VOID Create(),Delete(),Mkdir(),Directory(),Read(); CHAR Str[64]; CHAR LoopStr[64]; ULONG i; LARGE_INTEGER Time; printf("FatMain %d\n", LoopCount); NtQuerySystemTime(&Time); strcpy( Prefix, Device); Prefix[48] = 0; RtlIntegerToChar((ULONG)NtCurrentTeb()->ClientId.UniqueProcess, 16, -8, &Prefix[strlen(Device)]); Mkdir( Prefix ); Directory( Device ); Directory( Prefix ); for (i = 0; i < LoopCount; i += 1) { NtQuerySystemTime(&Time); strcpy(LoopStr, "Start loop xxxxxxxx "); RtlIntegerToChar(i, 16, -8, &LoopStr[11]); strcat( LoopStr, Prefix ); printf(LoopStr); printf("\n"); strcpy( Str, Prefix ); Create( strcat( Str, "\\1.tmp" ), Time.LowPart, 1 ); strcpy( Str, Prefix ); Create( strcat( Str, "\\2.tmp" ), Time.LowPart, 2 ); strcpy( Str, Prefix ); Create( strcat( Str, "\\4.tmp" ), Time.LowPart, 4 ); strcpy( Str, Prefix ); Create( strcat( Str, "\\8.tmp" ), Time.LowPart, 8 ); strcpy( Str, Prefix ); Create( strcat( Str, "\\16.tmp" ), Time.LowPart, 16 ); strcpy( Str, Prefix ); Create( strcat( Str, "\\32.tmp" ), Time.LowPart, 32 ); strcpy( Str, Prefix ); Create( strcat( Str, "\\64.tmp" ), Time.LowPart, 64 ); strcpy( Str, Prefix ); Create( strcat( Str, "\\128.tmp" ), Time.LowPart, 128 ); strcpy( Str, Prefix ); Create( strcat( Str, "\\236.tmp" ), Time.LowPart, 256 ); strcpy( Str, Prefix ); Create( strcat( Str, "\\512.tmp" ), Time.LowPart, 512 ); strcpy( Str, Prefix ); Create( strcat( Str, "\\1024.tmp" ), Time.LowPart, 1024 ); strcpy( Str, Prefix ); Create( strcat( Str, "\\2048.tmp" ), Time.LowPart, 2048 ); strcpy( Str, Prefix ); Create( strcat( Str, "\\4096.tmp" ), Time.LowPart, 4096 ); strcpy( Str, Prefix ); Create( strcat( Str, "\\8192.tmp" ), Time.LowPart, 8192 ); strcpy( Str, Prefix ); Create( strcat( Str, "\\16384.tmp" ), Time.LowPart, 16384 ); strcpy( Str, Prefix ); Create( strcat( Str, "\\32768.tmp" ), Time.LowPart, 32768 ); strcpy( Str, Prefix ); Read( strcat( Str, "\\1.tmp" ), Time.LowPart, 1 ); strcpy( Str, Prefix ); Read( strcat( Str, "\\2.tmp" ), Time.LowPart, 2 ); strcpy( Str, Prefix ); Read( strcat( Str, "\\4.tmp" ), Time.LowPart, 4 ); strcpy( Str, Prefix ); Read( strcat( Str, "\\8.tmp" ), Time.LowPart, 8 ); strcpy( Str, Prefix ); Read( strcat( Str, "\\16.tmp" ), Time.LowPart, 16 ); strcpy( Str, Prefix ); Read( strcat( Str, "\\32.tmp" ), Time.LowPart, 32 ); strcpy( Str, Prefix ); Read( strcat( Str, "\\64.tmp" ), Time.LowPart, 64 ); strcpy( Str, Prefix ); Read( strcat( Str, "\\128.tmp" ), Time.LowPart, 128 ); strcpy( Str, Prefix ); Read( strcat( Str, "\\236.tmp" ), Time.LowPart, 256 ); strcpy( Str, Prefix ); Read( strcat( Str, "\\512.tmp" ), Time.LowPart, 512 ); strcpy( Str, Prefix ); Read( strcat( Str, "\\1024.tmp" ), Time.LowPart, 1024 ); strcpy( Str, Prefix ); Read( strcat( Str, "\\2048.tmp" ), Time.LowPart, 2048 ); strcpy( Str, Prefix ); Read( strcat( Str, "\\4096.tmp" ), Time.LowPart, 4096 ); strcpy( Str, Prefix ); Read( strcat( Str, "\\8192.tmp" ), Time.LowPart, 8192 ); strcpy( Str, Prefix ); Read( strcat( Str, "\\16384.tmp" ), Time.LowPart, 16384 ); strcpy( Str, Prefix ); Read( strcat( Str, "\\32768.tmp" ), Time.LowPart, 32768 ); Directory( Device ); Directory( Prefix ); strcpy( Str, Prefix ); Delete( strcat( Str, "\\1.tmp" ) ); strcpy( Str, Prefix ); Delete( strcat( Str, "\\2.tmp" ) ); strcpy( Str, Prefix ); Delete( strcat( Str, "\\4.tmp" ) ); strcpy( Str, Prefix ); Delete( strcat( Str, "\\8.tmp" ) ); strcpy( Str, Prefix ); Delete( strcat( Str, "\\16.tmp" ) ); strcpy( Str, Prefix ); Delete( strcat( Str, "\\32.tmp" ) ); strcpy( Str, Prefix ); Delete( strcat( Str, "\\64.tmp" ) ); strcpy( Str, Prefix ); Delete( strcat( Str, "\\128.tmp" ) ); strcpy( Str, Prefix ); Delete( strcat( Str, "\\236.tmp" ) ); strcpy( Str, Prefix ); Delete( strcat( Str, "\\512.tmp" ) ); strcpy( Str, Prefix ); Delete( strcat( Str, "\\1024.tmp" ) ); strcpy( Str, Prefix ); Delete( strcat( Str, "\\2048.tmp" ) ); strcpy( Str, Prefix ); Delete( strcat( Str, "\\4096.tmp" ) ); strcpy( Str, Prefix ); Delete( strcat( Str, "\\8192.tmp" ) ); strcpy( Str, Prefix ); Delete( strcat( Str, "\\16384.tmp" ) ); strcpy( Str, Prefix ); Delete( strcat( Str, "\\32768.tmp" ) ); Directory( Device ); Directory( Prefix ); } printf( "Done\n" ); return; }
NTSTATUS CmpInitializeRegistryNode( IN PCONFIGURATION_COMPONENT_DATA CurrentEntry, IN HANDLE ParentHandle, OUT PHANDLE NewHandle, IN INTERFACE_TYPE InterfaceType, IN ULONG BusNumber, IN PUSHORT DeviceIndexTable ) /*++ Routine Description: This routine creates a node for the current firmware component and puts component data to the data part of the node. Arguments: CurrentEntry - Supplies a pointer to a configuration component. Handle - Supplies the parent handle of CurrentEntry node. NewHandle - Supplies a pointer to a HANDLE to receive the handle of the newly created node. InterfaceType - Specify the Interface type of the bus that the CurrentEntry component resides. (See BusNumber also) BusNumber - Specify the Bus Number of the bus that the CurrentEntry component resides on. If Bus number is -1, it means InterfaceType and BusNumber are meaningless for this component. Returns: None. --*/ { NTSTATUS Status; OBJECT_ATTRIBUTES ObjectAttributes; UNICODE_STRING KeyName; UNICODE_STRING ValueName; UNICODE_STRING ValueData; HANDLE Handle; HANDLE OldHandle; ANSI_STRING AnsiString; CHAR Buffer[12]; WCHAR UnicodeBuffer[12]; CONFIGURATION_COMPONENT *Component; ULONG Disposition; ULONG ConfigurationDataLength = 0; PCM_FULL_RESOURCE_DESCRIPTOR NewArea; Component = &CurrentEntry->ComponentEntry; // // If the component class is SystemClass, we set its Type to be // ArcSystem. The reason is because the detection code sets // its type to MaximumType to indicate it is NOT ARC compatible. // Here, we are only interested in building a System Node. So we // change its Type to ArcSystem to ease the setup. // if (Component->Class == SystemClass) { Component->Type = ArcSystem; } // // Create a new key to describe the Component. // // The type of the component will be used as the keyname of the // registry node. The class is the class of the component. // InitializeObjectAttributes( &ObjectAttributes, &(CmTypeName[Component->Type]), 0, ParentHandle, NULL ); ObjectAttributes.Attributes |= OBJ_CASE_INSENSITIVE; Status = NtCreateKey( // Paht may already exist &Handle, KEY_READ | KEY_WRITE, &ObjectAttributes, 0, NULL, 0, &Disposition ); if (!NT_SUCCESS(Status)) { return(Status); } // // If this component is NOT a SystemClass component, we will // create a subkey to identify the component's ordering. // if (Component->Class != SystemClass) { RtlIntegerToChar( DeviceIndexTable[Component->Type]++, 10, 12, Buffer ); RtlInitAnsiString( &AnsiString, Buffer ); KeyName.Buffer = (PWSTR)UnicodeBuffer; KeyName.Length = 0; KeyName.MaximumLength = sizeof(UnicodeBuffer); RtlAnsiStringToUnicodeString( &KeyName, &AnsiString, FALSE ); OldHandle = Handle; InitializeObjectAttributes( &ObjectAttributes, &KeyName, 0, OldHandle, NULL ); ObjectAttributes.Attributes |= OBJ_CASE_INSENSITIVE; Status = NtCreateKey( &Handle, KEY_READ | KEY_WRITE, &ObjectAttributes, 0, NULL, 0, &Disposition ); NtClose(OldHandle); if (!NT_SUCCESS(Status)) { return(Status); } ASSERT(Disposition == REG_CREATED_NEW_KEY); } // // Create a value which describes the following component information: // Flags, Cersion, Key, AffinityMask. // RtlInitUnicodeString( &ValueName, L"Component Information" ); Status = NtSetValueKey( Handle, &ValueName, TITLE_INDEX_VALUE, REG_BINARY, &Component->Flags, FIELD_OFFSET(CONFIGURATION_COMPONENT, ConfigurationDataLength) - FIELD_OFFSET(CONFIGURATION_COMPONENT, Flags) ); if (!NT_SUCCESS(Status)) { NtClose(Handle); return(Status); } // // Create a value which describes the component identifier, if any. // if (Component->IdentifierLength) { RtlInitUnicodeString( &ValueName, L"Identifier" ); RtlInitAnsiString( &AnsiString, Component->Identifier ); Status = RtlAnsiStringToUnicodeString( &ValueData, &AnsiString, TRUE ); if( NT_SUCCESS(Status) ) { Status = NtSetValueKey( Handle, &ValueName, TITLE_INDEX_VALUE, REG_SZ, ValueData.Buffer, ValueData.Length + sizeof( UNICODE_NULL ) ); RtlFreeUnicodeString(&ValueData); } if (!NT_SUCCESS(Status)) { NtClose(Handle); return(Status); } } // // Create a value entry for component configuration data. // RtlInitUnicodeString( &ValueName, L"Configuration Data" ); // // Create the configuration data based on CM_FULL_RESOURCE_DESCRIPTOR. // // Note the configuration data in firmware tree may be in the form of // CM_PARTIAL_RESOURCE_LIST or nothing. In both cases, we need to // set up the registry configuration data to be in the form of // CM_FULL_RESOURCE_DESCRIPTOR. // if (CurrentEntry->ConfigurationData) { // // This component has configuration data, we copy the data // to our work area, add some more data items and copy the new // configuration data to the registry. // ConfigurationDataLength = Component->ConfigurationDataLength + FIELD_OFFSET(CM_FULL_RESOURCE_DESCRIPTOR, PartialResourceList); // // Make sure our reserved area is big enough to hold the data. // if (ConfigurationDataLength > CmpConfigurationAreaSize) { // // If reserved area is not big enough, we resize our reserved // area. If, unfortunately, the reallocation fails, we simply // loss the configuration data of this particular component. // NewArea = (PCM_FULL_RESOURCE_DESCRIPTOR)ExAllocatePool( PagedPool, ConfigurationDataLength ); if (NewArea) { CmpConfigurationAreaSize = ConfigurationDataLength; ExFreePool(CmpConfigurationData); CmpConfigurationData = NewArea; RtlCopyMemory( (PUCHAR)&CmpConfigurationData->PartialResourceList.Version, CurrentEntry->ConfigurationData, Component->ConfigurationDataLength ); } else { Component->ConfigurationDataLength = 0; CurrentEntry->ConfigurationData = NULL; } } else { RtlCopyMemory( (PUCHAR)&CmpConfigurationData->PartialResourceList.Version, CurrentEntry->ConfigurationData, Component->ConfigurationDataLength ); } } if (CurrentEntry->ConfigurationData == NULL) { // // This component has NO configuration data (or we can't resize // our reserved area to hold the data), we simple add whatever // is required to set up a CM_FULL_RESOURCE_LIST. // CmpConfigurationData->PartialResourceList.Version = 0; CmpConfigurationData->PartialResourceList.Revision = 0; CmpConfigurationData->PartialResourceList.Count = 0; ConfigurationDataLength = FIELD_OFFSET(CM_FULL_RESOURCE_DESCRIPTOR, PartialResourceList) + FIELD_OFFSET(CM_PARTIAL_RESOURCE_LIST, PartialDescriptors); } // // Set up InterfaceType and BusNumber for the component. // CmpConfigurationData->InterfaceType = InterfaceType; CmpConfigurationData->BusNumber = BusNumber; // // Write the newly constructed configuration data to the hardware registry // Status = NtSetValueKey( Handle, &ValueName, TITLE_INDEX_VALUE, REG_FULL_RESOURCE_DESCRIPTOR, CmpConfigurationData, ConfigurationDataLength ); if (!NT_SUCCESS(Status)) { NtClose(Handle); return(Status); } *NewHandle = Handle; return(STATUS_SUCCESS); }
/*********************************************************************** * GetTempFileNameW (KERNEL32.@) */ UINT WINAPI GetTempFileNameW(IN LPCWSTR lpPathName, IN LPCWSTR lpPrefixString, IN UINT uUnique, OUT LPWSTR lpTempFileName) { CHAR * Let; HANDLE TempFile; UINT ID, Num = 0; CHAR IDString[5]; WCHAR * TempFileName; BASE_API_MESSAGE ApiMessage; PBASE_GET_TEMP_FILE GetTempFile = &ApiMessage.Data.GetTempFileRequest; DWORD FileAttributes, LastError; UNICODE_STRING PathNameString, PrefixString; static const WCHAR Ext[] = { L'.', 't', 'm', 'p', UNICODE_NULL }; RtlInitUnicodeString(&PathNameString, lpPathName); if (PathNameString.Length == 0 || PathNameString.Buffer[(PathNameString.Length / sizeof(WCHAR)) - 1] != L'\\') { PathNameString.Length += sizeof(WCHAR); } /* lpTempFileName must be able to contain: PathName, Prefix (3), number(4), .tmp(4) & \0(1) * See: http://msdn.microsoft.com/en-us/library/aa364991%28v=vs.85%29.aspx */ if (PathNameString.Length > (MAX_PATH - 3 - 4 - 4 - 1) * sizeof(WCHAR)) { SetLastError(ERROR_BUFFER_OVERFLOW); return 0; } /* If PathName and TempFileName aren't the same buffer, move PathName to TempFileName */ if (lpPathName != lpTempFileName) { memmove(lpTempFileName, PathNameString.Buffer, PathNameString.Length); } /* PathName MUST BE a path. Check it */ lpTempFileName[(PathNameString.Length / sizeof(WCHAR)) - 1] = UNICODE_NULL; FileAttributes = GetFileAttributesW(lpTempFileName); if (FileAttributes == INVALID_FILE_ATTRIBUTES) { /* Append a '\' if necessary */ lpTempFileName[(PathNameString.Length / sizeof(WCHAR)) - 1] = L'\\'; lpTempFileName[PathNameString.Length / sizeof(WCHAR)] = UNICODE_NULL; FileAttributes = GetFileAttributesW(lpTempFileName); if (FileAttributes == INVALID_FILE_ATTRIBUTES) { SetLastError(ERROR_DIRECTORY); return 0; } } if (!(FileAttributes & FILE_ATTRIBUTE_DIRECTORY)) { SetLastError(ERROR_DIRECTORY); return 0; } /* Make sure not to mix path & prefix */ lpTempFileName[(PathNameString.Length / sizeof(WCHAR)) - 1] = L'\\'; RtlInitUnicodeString(&PrefixString, lpPrefixString); if (PrefixString.Length > 3 * sizeof(WCHAR)) { PrefixString.Length = 3 * sizeof(WCHAR); } /* Append prefix to path */ TempFileName = lpTempFileName + PathNameString.Length / sizeof(WCHAR); memmove(TempFileName, PrefixString.Buffer, PrefixString.Length); TempFileName += PrefixString.Length / sizeof(WCHAR); /* Then, generate filename */ do { /* If user didn't gave any ID, ask Csrss to give one */ if (!uUnique) { CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, NULL, CSR_CREATE_API_NUMBER(BASESRV_SERVERDLL_INDEX, BasepGetTempFile), sizeof(BASE_GET_TEMP_FILE)); if (GetTempFile->UniqueID == 0) { Num++; continue; } ID = GetTempFile->UniqueID; } else { ID = uUnique; } /* Convert that ID to wchar */ RtlIntegerToChar(ID, 0x10, sizeof(IDString), IDString); Let = IDString; do { *(TempFileName++) = RtlAnsiCharToUnicodeChar(&Let); } while (*Let != 0); /* Append extension & UNICODE_NULL */ memmove(TempFileName, Ext, sizeof(Ext)); /* If user provided its ID, just return */ if (uUnique) { return uUnique; } /* Then, try to create file */ if (!RtlIsDosDeviceName_U(lpTempFileName)) { TempFile = CreateFileW(lpTempFileName, GENERIC_READ, 0, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, 0); if (TempFile != INVALID_HANDLE_VALUE) { NtClose(TempFile); DPRINT("Temp file: %S\n", lpTempFileName); return ID; } LastError = GetLastError(); /* There is no need to recover from those errors, they would hit next step */ if (LastError == ERROR_INVALID_PARAMETER || LastError == ERROR_CANNOT_MAKE || LastError == ERROR_WRITE_PROTECT || LastError == ERROR_NETWORK_ACCESS_DENIED || LastError == ERROR_DISK_FULL || LastError == ERROR_INVALID_NAME || LastError == ERROR_BAD_PATHNAME || LastError == ERROR_NO_INHERITANCE || LastError == ERROR_DISK_CORRUPT || (LastError == ERROR_ACCESS_DENIED && NtCurrentTeb()->LastStatusValue != STATUS_FILE_IS_A_DIRECTORY)) { break; } } Num++; } while (Num & 0xFFFF); return 0; }
NTSTATUS NTAPI INIT_FUNCTION CmpInitializeRegistryNode(IN PCONFIGURATION_COMPONENT_DATA CurrentEntry, IN HANDLE NodeHandle, OUT PHANDLE NewHandle, IN INTERFACE_TYPE InterfaceType, IN ULONG BusNumber, IN PUSHORT DeviceIndexTable) { NTSTATUS Status; OBJECT_ATTRIBUTES ObjectAttributes; UNICODE_STRING KeyName, ValueName, ValueData; HANDLE KeyHandle, ParentHandle; ANSI_STRING TempString; CHAR TempBuffer[12]; WCHAR Buffer[12]; PCONFIGURATION_COMPONENT Component; ULONG Disposition, Length = 0; /* Get the component */ Component = &CurrentEntry->ComponentEntry; /* Set system class components to ARC system type */ if (Component->Class == SystemClass) Component->Type = ArcSystem; /* Create a key for the component */ InitializeObjectAttributes(&ObjectAttributes, &CmTypeName[Component->Type], OBJ_CASE_INSENSITIVE, NodeHandle, NULL); Status = NtCreateKey(&KeyHandle, KEY_READ | KEY_WRITE, &ObjectAttributes, 0, NULL, 0, &Disposition); if (!NT_SUCCESS(Status)) return Status; /* Check if this is anything but a system class component */ if (Component->Class != SystemClass) { /* Build the sub-component string */ RtlIntegerToChar(DeviceIndexTable[Component->Type]++, 10, 12, TempBuffer); RtlInitAnsiString(&TempString, TempBuffer); /* Convert it to Unicode */ RtlInitEmptyUnicodeString(&KeyName, Buffer, sizeof(Buffer)); Status = RtlAnsiStringToUnicodeString(&KeyName, &TempString, FALSE); if (!NT_SUCCESS(Status)) { NtClose(KeyHandle); return Status; } /* Create the key */ ParentHandle = KeyHandle; InitializeObjectAttributes(&ObjectAttributes, &KeyName, OBJ_CASE_INSENSITIVE, ParentHandle, NULL); Status = NtCreateKey(&KeyHandle, KEY_READ | KEY_WRITE, &ObjectAttributes, 0, NULL, 0, &Disposition); NtClose(ParentHandle); /* Fail if the key couldn't be created, and make sure it's a new key */ if (!NT_SUCCESS(Status)) return Status; ASSERT(Disposition == REG_CREATED_NEW_KEY); } /* Setup the component information key */ RtlInitUnicodeString(&ValueName, L"Component Information"); Status = NtSetValueKey(KeyHandle, &ValueName, 0, REG_BINARY, &Component->Flags, FIELD_OFFSET(CONFIGURATION_COMPONENT, ConfigurationDataLength) - FIELD_OFFSET(CONFIGURATION_COMPONENT, Flags)); if (!NT_SUCCESS(Status)) { /* Fail */ NtClose(KeyHandle); return Status; } /* Check if we have an identifier */ if (Component->IdentifierLength) { /* Build the string and convert it to Unicode */ RtlInitUnicodeString(&ValueName, L"Identifier"); RtlInitAnsiString(&TempString, Component->Identifier); Status = RtlAnsiStringToUnicodeString(&ValueData, &TempString, TRUE); if (NT_SUCCESS(Status)) { /* Save the identifier in the registry */ Status = NtSetValueKey(KeyHandle, &ValueName, 0, REG_SZ, ValueData.Buffer, ValueData.Length + sizeof(UNICODE_NULL)); RtlFreeUnicodeString(&ValueData); } /* Check for failure during conversion or registry write */ if (!NT_SUCCESS(Status)) { /* Fail */ NtClose(KeyHandle); return Status; } } /* Setup the configuration data string */ RtlInitUnicodeString(&ValueName, L"Configuration Data"); /* Check if we got configuration data */ if (CurrentEntry->ConfigurationData) { /* Calculate the total length and check if it fits into our buffer */ Length = Component->ConfigurationDataLength + FIELD_OFFSET(CM_FULL_RESOURCE_DESCRIPTOR, PartialResourceList); if (Length > CmpConfigurationAreaSize) { ASSERTMSG("Component too large -- need reallocation!", FALSE); } else { /* Copy the data */ RtlCopyMemory(&CmpConfigurationData->PartialResourceList.Version, CurrentEntry->ConfigurationData, Component->ConfigurationDataLength); } } else { /* No configuration data, setup defaults */ CmpConfigurationData->PartialResourceList.Version = 0; CmpConfigurationData->PartialResourceList.Revision = 0; CmpConfigurationData->PartialResourceList.Count = 0; Length = FIELD_OFFSET(CM_PARTIAL_RESOURCE_LIST, PartialDescriptors) + FIELD_OFFSET(CM_FULL_RESOURCE_DESCRIPTOR, PartialResourceList); } /* Set the interface type and bus number */ CmpConfigurationData->InterfaceType = InterfaceType; CmpConfigurationData->BusNumber = BusNumber; /* Save the actual data */ Status = NtSetValueKey(KeyHandle, &ValueName, 0, REG_FULL_RESOURCE_DESCRIPTOR, CmpConfigurationData, Length); if (!NT_SUCCESS(Status)) { /* Fail */ NtClose(KeyHandle); } else { /* Return the new handle */ *NewHandle = KeyHandle; } /* Return status */ return Status; }
int _CDECL main( int argc, char *argv[] ) { ULONG Seed; ULONG Temp; ULONG i; CHAR Str[64]; DbgPrint("Start IntegerToChar and CharToInteger Test\n"); Seed = 0x12345678; RtlIntegerToChar(Seed, 2, sizeof(Str), Str); DbgPrint("Seed = 0b%s\n", Str); RtlCharToInteger(Str, 2, &Temp); ASSERTMSG( "RtlCharToInteger(2)", (Seed == Temp) ); RtlIntegerToChar(Seed, 8, sizeof(Str), Str); DbgPrint("Seed = 0o%s\n", Str); RtlCharToInteger(Str, 8, &Temp); ASSERTMSG( "RtlCharToInteger(8)", (Seed == Temp) ); RtlIntegerToChar(Seed, 10, sizeof(Str), Str); DbgPrint("Seed = %s\n", Str); RtlCharToInteger(Str, 10, &Temp); ASSERTMSG( "RtlCharToInteger(10)", (Seed == Temp) ); RtlIntegerToChar(Seed, 16, -8, Str); Str[ 8 ] = '\0'; DbgPrint("Seed = 0x%s\n", Str); RtlCharToInteger(Str, 16, &Temp); ASSERTMSG( "RtlCharToInteger(16)", (Seed == Temp) ); DbgPrint("End IntegerToChar and CharToInteger Test\n"); DbgPrint("Start RandomTest()\n"); Seed = 0; for (i=0; i<2048; i++) { if ((i % 3) == 0) { DbgPrint("\n"); } RtlRandom(&Seed); DbgPrint("%p ", Seed); RtlIntegerToChar(Seed, 16, sizeof(Str), Str); DbgPrint("= %s ", Str); } DbgPrint("\n"); DbgPrint("End RandomTest()\n"); return TRUE; }