本文整理汇总了C++中RtlAnsiStringToUnicodeString函数的典型用法代码示例。如果您正苦于以下问题:C++ RtlAnsiStringToUnicodeString函数的具体用法?C++ RtlAnsiStringToUnicodeString怎么用?C++ RtlAnsiStringToUnicodeString使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了RtlAnsiStringToUnicodeString函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RtlCreateUnicodeStringFromAsciiz
BOOLEAN
RtlCreateUnicodeStringFromAsciiz(
OUT PUNICODE_STRING DestinationString,
IN PCSZ SourceString
)
{
ANSI_STRING AnsiString;
NTSTATUS Status;
RtlInitAnsiString( &AnsiString, SourceString );
Status = RtlAnsiStringToUnicodeString( DestinationString, &AnsiString, TRUE );
if (NT_SUCCESS( Status )) {
return( TRUE );
}
else {
return( FALSE );
}
}
示例2: FatalAppExitA
/*
* @unimplemented
*/
VOID
WINAPI
FatalAppExitA(UINT uAction,
LPCSTR lpMessageText)
{
UNICODE_STRING MessageTextU;
ANSI_STRING MessageText;
RtlInitAnsiString(&MessageText, (LPSTR)lpMessageText);
RtlAnsiStringToUnicodeString(&MessageTextU,
&MessageText,
TRUE);
FatalAppExitW(uAction, MessageTextU.Buffer);
RtlFreeUnicodeString(&MessageTextU);
}
示例3: ElfrRegisterEventSourceA
/* Function 15 */
NTSTATUS
ElfrRegisterEventSourceA(
EVENTLOG_HANDLE_A UNCServerName,
PRPC_STRING ModuleName,
PRPC_STRING RegModuleName,
ULONG MajorVersion,
ULONG MinorVersion,
PIELF_HANDLE LogHandle)
{
NTSTATUS Status;
UNICODE_STRING ModuleNameW;
Status = RtlAnsiStringToUnicodeString(&ModuleNameW,
(PANSI_STRING)ModuleName,
TRUE);
if (!NT_SUCCESS(Status))
{
DPRINT1("RtlAnsiStringToUnicodeString failed (Status 0x%08lx)\n", Status);
return Status;
}
/* RegModuleName must be an empty string */
if (RegModuleName->Length > 0)
{
RtlFreeUnicodeString(&ModuleNameW);
return STATUS_INVALID_PARAMETER;
}
if ((MajorVersion != 1) || (MinorVersion != 1))
{
RtlFreeUnicodeString(&ModuleNameW);
return STATUS_INVALID_PARAMETER;
}
/* FIXME: Must verify that caller has write access */
Status = ElfCreateEventLogHandle((PLOGHANDLE*)LogHandle,
&ModuleNameW,
TRUE);
RtlFreeUnicodeString(&ModuleNameW);
return Status;
}
示例4: ElfrBackupELFA
/* Function 13 */
NTSTATUS
ElfrBackupELFA(
IELF_HANDLE LogHandle,
PRPC_STRING BackupFileName)
{
NTSTATUS Status;
UNICODE_STRING BackupFileNameW;
Status = RtlAnsiStringToUnicodeString(&BackupFileNameW,
(PANSI_STRING)BackupFileName,
TRUE);
if (!NT_SUCCESS(Status))
return Status;
Status = ElfrBackupELFW(LogHandle,
(PRPC_UNICODE_STRING)&BackupFileNameW);
RtlFreeUnicodeString(&BackupFileNameW);
return Status;
}
示例5: ElfrOpenBELA
/* Function 16 */
NTSTATUS
ElfrOpenBELA(
EVENTLOG_HANDLE_A UNCServerName,
PRPC_STRING BackupFileName,
ULONG MajorVersion,
ULONG MinorVersion,
PIELF_HANDLE LogHandle)
{
NTSTATUS Status;
UNICODE_STRING BackupFileNameW;
DPRINT("ElfrOpenBELA(%Z)\n", BackupFileName);
Status = RtlAnsiStringToUnicodeString(&BackupFileNameW,
(PANSI_STRING)BackupFileName,
TRUE);
if (!NT_SUCCESS(Status))
{
DPRINT1("RtlAnsiStringToUnicodeString failed (Status 0x%08lx)\n", Status);
return Status;
}
if ((MajorVersion != 1) || (MinorVersion != 1))
{
RtlFreeUnicodeString(&BackupFileNameW);
return STATUS_INVALID_PARAMETER;
}
/* FIXME: UNCServerName must specify the server */
/* FIXME: Must verify that caller has read access */
Status = ElfCreateBackupLogHandle((PLOGHANDLE*)LogHandle,
&BackupFileNameW);
RtlFreeUnicodeString(&BackupFileNameW);
return Status;
}
示例6: GetDriverGlobals
NTSTATUS
FxDriver::OpenParametersKey(
VOID
)
{
HRESULT hr;
NTSTATUS status;
PFX_DRIVER_GLOBALS FxDriverGlobals = GetDriverGlobals();
PDRIVER_OBJECT_UM pDrvObj = GetDriverObject();
IWudfDeviceStack* pDevStack = (IWudfDeviceStack*)pDrvObj->WudfDevStack;
UMINT::WDF_PROPERTY_STORE_ROOT rootSpecifier;
UMINT::WDF_PROPERTY_STORE_RETRIEVE_FLAGS flags;
CANSI_STRING serviceNameA;
DECLARE_UNICODE_STRING_SIZE(serviceNameW, WDF_DRIVER_GLOBALS_NAME_LEN);
HKEY hKey;
RtlInitAnsiString(&serviceNameA, FxDriverGlobals->Public.DriverName);
status = RtlAnsiStringToUnicodeString(&serviceNameW,
&serviceNameA,
FALSE);
if (NT_SUCCESS(status)) {
rootSpecifier.LengthCb = sizeof(UMINT::WDF_PROPERTY_STORE_ROOT);
rootSpecifier.RootClass = UMINT::WdfPropertyStoreRootDriverParametersKey;
rootSpecifier.Qualifier.ParametersKey.ServiceName = serviceNameW.Buffer;
flags = UMINT::WdfPropertyStoreCreateIfMissing;
hr = pDevStack->CreateRegistryEntry(&rootSpecifier,
flags,
GENERIC_ALL & ~(GENERIC_WRITE | KEY_CREATE_SUB_KEY | WRITE_DAC),
NULL,
&hKey,
NULL);
status = FxDevice::NtStatusFromHr(pDevStack, hr);
if (NT_SUCCESS(status)) {
m_DriverParametersKey = hKey;
}
}
return status;
}
示例7: CreateSemaphoreExA
/*
* @implemented
*/
HANDLE
WINAPI
CreateSemaphoreExA(IN LPSECURITY_ATTRIBUTES lpSemaphoreAttributes OPTIONAL,
IN LONG lInitialCount,
IN LONG lMaximumCount,
IN LPCSTR lpName OPTIONAL,
IN DWORD dwFlags,
IN DWORD dwDesiredAccess)
{
NTSTATUS Status;
ANSI_STRING AnsiName;
PUNICODE_STRING UnicodeCache;
LPCWSTR UnicodeName = NULL;
/* Check for a name */
if (lpName)
{
/* Use TEB Cache */
UnicodeCache = &NtCurrentTeb()->StaticUnicodeString;
/* Convert to unicode */
RtlInitAnsiString(&AnsiName, lpName);
Status = RtlAnsiStringToUnicodeString(UnicodeCache, &AnsiName, FALSE);
if (!NT_SUCCESS(Status))
{
/* Conversion failed */
SetLastErrorByStatus(Status);
return NULL;
}
/* Otherwise, save the buffer */
UnicodeName = (LPCWSTR)UnicodeCache->Buffer;
}
/* Call the Unicode API */
return CreateSemaphoreExW(lpSemaphoreAttributes,
lInitialCount,
lMaximumCount,
UnicodeName,
dwFlags,
dwDesiredAccess);
}
示例8: HalReportResourceUsage
VOID
HalReportResourceUsage(
VOID
)
/*++
Routine Description:
Arguments:
Return Value:
--*/
{
ANSI_STRING AHalName;
UNICODE_STRING UHalName;
//
// Report IO space usage
// for HAL/system resources
//
RtlInitAnsiString (&AHalName, HalName);
RtlAnsiStringToUnicodeString (&UHalName, &AHalName, TRUE);
HalpReportResourceUsage (
&UHalName,
PCIBus
);
//RtlFreeUnicodeString (&UHalName);
//
// Now create the registry keys
// used to log errors if they
// do not already exist
//
HalpCreateLogKeys();
}
示例9: cfsd_UserModeCommunication
/*
* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= **
*
*
* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= **
*/
NTSTATUS
cfsd_UserModeCommunication( IN PVOID ConnectionCookie,
IN PVOID InputBuffer OPTIONAL,
IN ULONG InputBufferSize,
OUT PVOID OutputBuffer OPTIONAL,
IN ULONG OutputBufferSize,
OUT PULONG ReturnOutputBufferLength )
{
STRING FNameString;
KdPrint( (PRINT_TAG "File Name from USER MODE to hide (%s) [%d]\n", InputBuffer, InputBufferSize ) );
/*
!!!!!!!!!!!!!!!
ALL TEMP CODE SO YOU CAN TEST THE DRIVER FROM USER MODE WITHOUT HAVING TO RECOMPILE TO CHANGE A FILE NAME
!!!!!!!!!!!!!!
*/
try
{
RtlInitAnsiString( &FNameString, InputBuffer );
RtlAnsiStringToUnicodeString( &uFName, &FNameString, TRUE );
RtlUpcaseUnicodeString( &uFName, &uFName, FALSE );
gHiddenData->HFile = uFName;
// By not calling this we are going to leak memory everytime user mode makes a file name change. This is just a kludge
// to let user mode experiement with file names
// RtlFreeUnicodeString(&uFName);
}
except( EXCEPTION_EXECUTE_HANDLER )
{
return GetExceptionCode();
}
return STATUS_SUCCESS;
}
示例10: WSASocketA
/*
* @implemented
*/
SOCKET
EXPORT
WSASocketA(IN INT af,
IN INT type,
IN INT protocol,
IN LPWSAPROTOCOL_INFOA lpProtocolInfo,
IN GROUP g,
IN DWORD dwFlags)
/*
* FUNCTION: Creates a new socket
*/
{
WSAPROTOCOL_INFOW ProtocolInfoW;
LPWSAPROTOCOL_INFOW p;
UNICODE_STRING StringU;
ANSI_STRING StringA;
WS_DbgPrint(MAX_TRACE, ("af (%d) type (%d) protocol (%d).\n",
af, type, protocol));
if (lpProtocolInfo)
{
memcpy(&ProtocolInfoW,
lpProtocolInfo,
sizeof(WSAPROTOCOL_INFOA) - sizeof(CHAR) * (WSAPROTOCOL_LEN + 1));
RtlInitAnsiString(&StringA, (LPSTR)lpProtocolInfo->szProtocol);
RtlInitUnicodeString(&StringU, (LPWSTR)&ProtocolInfoW.szProtocol);
RtlAnsiStringToUnicodeString(&StringU, &StringA, FALSE);
p = &ProtocolInfoW;
}
else
{
p = NULL;
}
return WSASocketW(af,
type,
protocol,
p,
g,
dwFlags);
}
示例11: my_unload
/******************************************************************************
* Driver unload handler *
******************************************************************************/
static VOID DDKAPI
my_unload(PDRIVER_OBJECT DriverObject)
{
ANSI_STRING SymbolicLinkNameA;
UNICODE_STRING SymbolicLinkNameW;
DbgPrint("DriverUnload called\r\n");
PsSetCreateProcessNotifyRoutine(create_process_watcher, TRUE);
PsRemoveLoadImageNotifyRoutine(load_image_watcher);
RtlInitString(&SymbolicLinkNameA, MY_DOSDEVICE_NAME);
RtlAnsiStringToUnicodeString(&SymbolicLinkNameW, &SymbolicLinkNameA, TRUE);
IoDeleteSymbolicLink(&SymbolicLinkNameW);
IoDeleteDevice(DriverObject->DeviceObject);
for (int i = 0; i < ENT_CNT; ++i)
if(g_proc_table[i].pid)
DbgPrint("Registered process stays: %d\r\n", g_proc_table[i].pid);
}
示例12: RtlLargeStringToUnicodeString
BOOL
NTAPI
RtlLargeStringToUnicodeString( PUNICODE_STRING DestinationString,
PLARGE_STRING SourceString)
{
ANSI_STRING AnsiString;
RtlInitUnicodeString(DestinationString, NULL);
if (DestinationString && SourceString && SourceString->bAnsi)
{
RtlInitAnsiString(&AnsiString, (LPSTR)SourceString->Buffer);
return NT_SUCCESS(RtlAnsiStringToUnicodeString(DestinationString, &AnsiString, TRUE));
}
else if (DestinationString && SourceString)
{
return RtlCreateUnicodeString(DestinationString, SourceString->Buffer);
}
else
return FALSE;
}
示例13: OnWrite
NTSTATUS
OnWrite(PDEVICE_OBJECT pDeviceObj,
PIRP pIrp)
{
DbgPrint("%s", "Write Called\n");
PIO_STACK_LOCATION stack_location = IoGetCurrentIrpStackLocation(pIrp);
PVOID system_buffer = pIrp->AssociatedIrp.SystemBuffer;
ULONG write_size = stack_location->Parameters.Write.Length;
PVOID &context = stack_location->FileObject->FsContext;
ANSI_STRING ansi_string = {write_size, write_size, (PCHAR)system_buffer};
context = (PUNICODE_STRING)ExAllocatePoolWithTag(PagedPool, sizeof(UNICODE_STRING), TAG_CONVERSION);
RtlAnsiStringToUnicodeString((PUNICODE_STRING)context, &ansi_string, TRUE);
pIrp->IoStatus.Information = write_size;
pIrp->IoStatus.Status = STATUS_SUCCESS;
IoCompleteRequest(pIrp, IO_NO_INCREMENT);
return STATUS_SUCCESS;
}
示例14: AbortSystemShutdownA
/**********************************************************************
* AbortSystemShutdownA
*
* @unimplemented
*/
BOOL WINAPI
AbortSystemShutdownA(LPCSTR lpMachineName)
{
ANSI_STRING MachineNameA;
UNICODE_STRING MachineNameW;
NTSTATUS Status;
BOOL rv;
RtlInitAnsiString(&MachineNameA, (LPSTR)lpMachineName);
Status = RtlAnsiStringToUnicodeString(&MachineNameW, &MachineNameA, TRUE);
if (STATUS_SUCCESS != Status)
{
SetLastError(RtlNtStatusToDosError(Status));
return FALSE;
}
rv = AbortSystemShutdownW(MachineNameW.Buffer);
RtlFreeUnicodeString(&MachineNameW);
SetLastError(ERROR_SUCCESS);
return rv;
}
示例15: RegistryDeleteSubKey
NTSTATUS
RegistryDeleteSubKey(
IN PHANDLE Key,
IN PCHAR Name
)
{
ANSI_STRING Ansi;
UNICODE_STRING Unicode;
HANDLE SubKey;
NTSTATUS status;
RtlInitAnsiString(&Ansi, Name);
status = RtlAnsiStringToUnicodeString(&Unicode, &Ansi, TRUE);
if (!NT_SUCCESS(status))
goto fail1;
status = RegistryOpenKey(Key, &Unicode, KEY_ALL_ACCESS, &SubKey);
if (!NT_SUCCESS(status))
goto fail2;
status = ZwDeleteKey(SubKey);
if (!NT_SUCCESS(status))
goto fail3;
ZwClose(SubKey);
RtlFreeUnicodeString(&Unicode);
return STATUS_SUCCESS;
fail3:
ZwClose(SubKey);
fail2:
RtlFreeUnicodeString(&Unicode);
fail1:
return status;
}