当前位置: 首页>>代码示例>>C++>>正文


C++ RtlCopyUnicodeString函数代码示例

本文整理汇总了C++中RtlCopyUnicodeString函数的典型用法代码示例。如果您正苦于以下问题:C++ RtlCopyUnicodeString函数的具体用法?C++ RtlCopyUnicodeString怎么用?C++ RtlCopyUnicodeString使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了RtlCopyUnicodeString函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: CreateDevice

NTSTATUS CreateDevice (IN PDRIVER_OBJECT pDriverObject) 
{
	KdPrint(("CreateDevice begin\n"));

	NTSTATUS status;
	//设备对象 指针
	PDEVICE_OBJECT pDevObj;
	//设备对象扩展结构 指针
	PDEVICE_EXTENSION pDevExt;
	
	//设备名称
	UNICODE_STRING devName;
	RtlInitUnicodeString(&devName,DRIVER_NAME);
	
	//创建设备
	status = IoCreateDevice( pDriverObject,			//驱动对象
						sizeof(DEVICE_EXTENSION),	//设备扩展结构大小
						&(UNICODE_STRING)devName,	//设备名 或 NULL
						FILE_DEVICE_UNKNOWN,		//设备类型 FILE_DEVICE_UNKNOWN 未知虚拟设备,且为独占(既只能被一个应用程序使用) 
						0, TRUE,
						&pDevObj );					//设备地址 out

	if (!NT_SUCCESS(status))
		return status;

	//以直接的方式读写(既不使用缓冲区)
	pDevObj->Flags |= DO_DIRECT_IO;

	//填充扩展结构数据
	pDevExt = (PDEVICE_EXTENSION)pDevObj->DeviceExtension;
	pDevExt->pDevice = pDevObj;
	//申请内存 保存设备名
	ULONG length=wcslen(DRIVER_NAME)*sizeof(WCHAR);
	pDevExt->ustrDeviceName.Buffer=(PWCH)ExAllocatePool(PagedPool,length);
	pDevExt->ustrDeviceName.Length=pDevExt->ustrDeviceName.MaximumLength=length;
	RtlCopyUnicodeString(&pDevExt->ustrDeviceName,&devName);
	
	//符号链接名
	UNICODE_STRING symLinkName;
	RtlInitUnicodeString(&symLinkName,DRIVER_LINK_NAME);
	
	//创建符号链接
	pDevExt->ustrSymLinkName = symLinkName;
	status = IoCreateSymbolicLink( &symLinkName,&devName );
	
	if (!NT_SUCCESS(status)) 
	{
		IoDeleteDevice( pDevObj );
		return status;
	}
	//申请内存 保存 符号链接名
	length=wcslen(DRIVER_LINK_NAME)*sizeof(WCHAR);
	pDevExt->ustrSymLinkName.Buffer=(PWCH)ExAllocatePool(PagedPool,length);
	pDevExt->ustrSymLinkName.Length=pDevExt->ustrSymLinkName.MaximumLength=length;
	RtlCopyUnicodeString(&pDevExt->ustrSymLinkName,&symLinkName);
	
	KdPrint(("CreateDevice sucess and end\n"));
	return STATUS_SUCCESS;
}
开发者ID:zuiwuchang,项目名称:document,代码行数:59,代码来源:Driver.cpp

示例2: KdbSymProcessSymbols

VOID
KdbSymProcessSymbols(
    IN PLDR_DATA_TABLE_ENTRY LdrEntry)
{
    if (!LoadSymbols)
    {
        LdrEntry->PatchInformation = NULL;
        return;
    }

    /* Remove symbol info if it already exists */
    if (LdrEntry->PatchInformation) {
        KdbpSymRemoveCachedFile(LdrEntry->PatchInformation);
    }

	/* Error loading symbol info, try to load it from file */
	KdbpSymLoadModuleSymbols(&LdrEntry->FullDllName,
            (PROSSYM_INFO*)&LdrEntry->PatchInformation);

    if (!LdrEntry->PatchInformation) {
        // HACK: module dll names don't identify the real files
        UNICODE_STRING SystemRoot;
        UNICODE_STRING ModuleNameCopy;
        RtlInitUnicodeString(&SystemRoot, L"\\SystemRoot\\System32\\Drivers\\");
        ModuleNameCopy.Length = 0;
        ModuleNameCopy.MaximumLength =
            LdrEntry->BaseDllName.MaximumLength + SystemRoot.MaximumLength;
        ModuleNameCopy.Buffer = ExAllocatePool(NonPagedPool, SystemRoot.MaximumLength + LdrEntry->BaseDllName.MaximumLength);
        RtlCopyUnicodeString(&ModuleNameCopy, &SystemRoot);
        RtlCopyMemory
            (ModuleNameCopy.Buffer + ModuleNameCopy.Length / sizeof(WCHAR),
             LdrEntry->BaseDllName.Buffer,
             LdrEntry->BaseDllName.Length);
        ModuleNameCopy.Length += LdrEntry->BaseDllName.Length;
        KdbpSymLoadModuleSymbols(&ModuleNameCopy,
                                 (PROSSYM_INFO*)&LdrEntry->PatchInformation);
        if (!LdrEntry->PatchInformation) {
            SystemRoot.Length -= strlen("Drivers\\") * sizeof(WCHAR);
            RtlCopyUnicodeString(&ModuleNameCopy, &SystemRoot);
            RtlCopyMemory
                (ModuleNameCopy.Buffer + ModuleNameCopy.Length / sizeof(WCHAR),
                 LdrEntry->BaseDllName.Buffer,
                 LdrEntry->BaseDllName.Length);
            ModuleNameCopy.Length += LdrEntry->BaseDllName.Length;
            KdbpSymLoadModuleSymbols(&ModuleNameCopy,
                                     (PROSSYM_INFO*)&LdrEntry->PatchInformation);
        }
        RtlFreeUnicodeString(&ModuleNameCopy);
    }

	/* It already added symbols to cache */
    DPRINT("Installed symbols: %[email protected]%p-%p %p\n",
           &LdrEntry->BaseDllName,
           LdrEntry->DllBase,
           (PVOID)(LdrEntry->SizeOfImage + (ULONG_PTR)LdrEntry->DllBase),
           LdrEntry->PatchInformation);
}
开发者ID:GYGit,项目名称:reactos,代码行数:57,代码来源:kdb_symbols.cmake.c

示例3: DriverEntry

NTSTATUS DriverEntry(__in PDRIVER_OBJECT DriverObject, __in PUNICODE_STRING RegistryPath)
{
    Bus_KdPrint(("Driver Entry\n"));

    ExInitializeNPagedLookasideList(&g_LookAside, NULL, NULL, 0, sizeof(PENDING_IRP), BUSENUM_POOL_TAG, 0);

	Globals.RegistryPath.MaximumLength = RegistryPath->Length + sizeof(UNICODE_NULL);
    Globals.RegistryPath.Length = RegistryPath->Length;
    Globals.RegistryPath.Buffer = ExAllocatePoolWithTag(PagedPool, Globals.RegistryPath.MaximumLength, BUSENUM_POOL_TAG);

    if (!Globals.RegistryPath.Buffer)
	{
		return STATUS_INSUFFICIENT_RESOURCES;
    }

    RtlCopyUnicodeString(&Globals.RegistryPath, RegistryPath);

    DriverObject->MajorFunction [IRP_MJ_CREATE                 ] =
    DriverObject->MajorFunction [IRP_MJ_CLOSE                  ] = Bus_CreateClose;
    DriverObject->MajorFunction [IRP_MJ_PNP                    ] = Bus_PnP;
    DriverObject->MajorFunction [IRP_MJ_POWER                  ] = Bus_Power;
    DriverObject->MajorFunction [IRP_MJ_DEVICE_CONTROL         ] = Bus_IoCtl;
    DriverObject->MajorFunction [IRP_MJ_INTERNAL_DEVICE_CONTROL] = Bus_Internal_IoCtl;

	DriverObject->DriverUnload = Bus_DriverUnload;
    DriverObject->DriverExtension->AddDevice = Bus_AddDevice;

    return STATUS_SUCCESS;
}
开发者ID:imahmoodz,项目名称:ScpToolkit,代码行数:29,代码来源:busenum.c

示例4: KdbpSymAddCachedFile

/*! \brief Add a symbol file to the cache.
 *
 * \param FileName    Filename of the symbol file.
 * \param RosSymInfo  Pointer to the symbol info.
 *
 * \sa KdbpSymRemoveCachedFile
 */
static VOID
KdbpSymAddCachedFile(
    IN PUNICODE_STRING FileName,
    IN PROSSYM_INFO RosSymInfo)
{
    PIMAGE_SYMBOL_INFO_CACHE CacheEntry;
    KIRQL Irql;

    DPRINT("Adding symbol file: RosSymInfo = %p\n", RosSymInfo);

    /* allocate entry */
    CacheEntry = ExAllocatePoolWithTag(NonPagedPool, sizeof (IMAGE_SYMBOL_INFO_CACHE), TAG_KDBS);
    ASSERT(CacheEntry);
    RtlZeroMemory(CacheEntry, sizeof (IMAGE_SYMBOL_INFO_CACHE));

    /* fill entry */
    CacheEntry->FileName.Buffer = ExAllocatePoolWithTag(NonPagedPool,
                                                        FileName->Length,
                                                        TAG_KDBS);
    RtlCopyUnicodeString(&CacheEntry->FileName, FileName);
    ASSERT(CacheEntry->FileName.Buffer);
    CacheEntry->RefCount = 1;
    CacheEntry->RosSymInfo = RosSymInfo;
    KeAcquireSpinLock(&SymbolFileListLock, &Irql);
    InsertTailList(&SymbolFileListHead, &CacheEntry->ListEntry);
    KeReleaseSpinLock(&SymbolFileListLock, Irql);
}
开发者ID:hoangduit,项目名称:reactos,代码行数:34,代码来源:kdb_symbols.c

示例5: KdbpSymAddCachedFile

/*! \brief Add a symbol file to the cache.
 *
 * \param FileName    Filename of the symbol file.
 * \param RosSymInfo  Pointer to the symbol info.
 *
 * \sa KdbpSymRemoveCachedFile
 */
static VOID
KdbpSymAddCachedFile(
    IN PUNICODE_STRING FileName,
    IN PROSSYM_INFO RosSymInfo)
{
    PIMAGE_SYMBOL_INFO_CACHE CacheEntry;

    DPRINT("Adding symbol file: %wZ RosSymInfo = %p\n", FileName, RosSymInfo);

    /* allocate entry */
    CacheEntry = ExAllocatePoolWithTag(NonPagedPool, sizeof (IMAGE_SYMBOL_INFO_CACHE), TAG_KDBS);
    ASSERT(CacheEntry);
    RtlZeroMemory(CacheEntry, sizeof (IMAGE_SYMBOL_INFO_CACHE));

    /* fill entry */
    CacheEntry->FileName.Buffer = ExAllocatePoolWithTag(NonPagedPool,
                                                        FileName->Length,
                                                        TAG_KDBS);
    CacheEntry->FileName.MaximumLength = FileName->Length;
    RtlCopyUnicodeString(&CacheEntry->FileName, FileName);
    ASSERT(CacheEntry->FileName.Buffer);
    CacheEntry->RefCount = 1;
    CacheEntry->RosSymInfo = RosSymInfo;
    InsertTailList(&SymbolFileListHead, &CacheEntry->ListEntry); /* FIXME: Lock list? */
}
开发者ID:GYGit,项目名称:reactos,代码行数:32,代码来源:kdb_symbols.cmake.c

示例6: ConstructDeviceName

NTSTATUS
ConstructDeviceName(
    IN  PCWSTR Path,
    IN  UCHAR Index,
    OUT PUNICODE_STRING DeviceName)
{
    UNICODE_STRING UnicodePath;
    UNICODE_STRING UnicodeIndex;
    WCHAR IndexStringBuffer[5];
    USHORT Size;
    USHORT LastCharacterIndex;

    /* Check for NULL parameters */
    if ( ( ! Path ) || ( ! DeviceName ) )
    {
        DPRINT("Unexpected NULL parameter");
        return STATUS_INVALID_PARAMETER;
    }

    /* Range-check */
    if ( Index >= SOUND_MAX_DEVICES )
    {
        DPRINT("Device index %d out of range", Index);
        return STATUS_INVALID_PARAMETER;
    }

    /* Initialise the unicode path string */
    RtlInitUnicodeString(&UnicodePath, Path);

    /* Calculate the length to hold the full string */
    Size = UnicodePath.Length +
           sizeof(IndexStringBuffer) +
           sizeof(UNICODE_NULL);

    /* Allocate memory for DeviceName */
    DeviceName->Buffer = ExAllocatePool(PagedPool, Size);
    DeviceName->MaximumLength = Size;

    if ( ! DeviceName->Buffer )
    {
        DPRINT("Couldn't allocate memory for device name string");
        return STATUS_INSUFFICIENT_RESOURCES;
    }

    /* Copy the path */
    RtlCopyUnicodeString(DeviceName, &UnicodePath);

    /* Convert Index to string and append */
    UnicodeIndex.Buffer = IndexStringBuffer;
    UnicodeIndex.MaximumLength = sizeof(IndexStringBuffer);

    RtlIntegerToUnicodeString((ULONG)Index, 10, &UnicodeIndex);
    RtlAppendUnicodeStringToString(DeviceName, &UnicodeIndex);

    /* Terminate the string */
    LastCharacterIndex = DeviceName->Length / sizeof(UNICODE_NULL);
    DeviceName->Buffer[LastCharacterIndex] = UNICODE_NULL;

    return STATUS_SUCCESS;
}
开发者ID:hoangduit,项目名称:reactos,代码行数:60,代码来源:devname.c

示例7: CtxUpdateNameInStreamHandleContext

/*++

Routine Description:

    This routine updates the name of the target in the supplied stream handle context

Arguments:

    DirectoryName             - Supplies the directory name
    StreamHandleContext   - Returns the updated name in the stream context

Return Value:

    Status

Note:

    The caller must synchronize access to the context. This routine does no
    synchronization

--*/
NTSTATUS
CtxUpdateNameInStreamHandleContext (
    __in PUNICODE_STRING DirectoryName,
    __inout PCTX_STREAMHANDLE_CONTEXT StreamHandleContext
    )
{
    NTSTATUS status;

    PAGED_CODE();

    //
    //  Free any existing name
    //

    if (StreamHandleContext->FileName.Buffer != NULL) 
	{
        CtxFreeUnicodeString(&StreamHandleContext->FileName);
    }


    //
    //  Allocate and copy off the directory name
    //

    StreamHandleContext->FileName.MaximumLength = DirectoryName->Length;
    status = CtxAllocateUnicodeString(&StreamHandleContext->FileName);
    if (NT_SUCCESS(status))
	{
        RtlCopyUnicodeString(&StreamHandleContext->FileName, DirectoryName);
    }

    return status;
}
开发者ID:killbug2004,项目名称:wy-windows-driver,代码行数:54,代码来源:context.c

示例8: Secondary_ChangeFcbFileName

VOID
Secondary_ChangeFcbFileName(
	IN PIRP_CONTEXT		IrpContext,
	IN PFCB				Fcb,
	IN PUNICODE_STRING	FullFileName
	)
{
    RtlInitEmptyUnicodeString( &Fcb->FullFileName,
							   Fcb->FullFileNameBuffer,
							   sizeof(Fcb->FullFileNameBuffer) );

	RtlCopyUnicodeString( &Fcb->FullFileName, FullFileName );

    RtlInitEmptyUnicodeString( &Fcb->CaseInSensitiveFullFileName,
							   Fcb->CaseInSensitiveFullFileNameBuffer,
							   sizeof(Fcb->CaseInSensitiveFullFileNameBuffer) );

	RtlDowncaseUnicodeString( &Fcb->CaseInSensitiveFullFileName,
							  &Fcb->FullFileName,
							  FALSE );

	if (FullFileName->Length && FullFileName->Buffer[0] != L'\\')
		ASSERT( NDFAT_BUG );

	return;
}
开发者ID:tigtigtig,项目名称:ndas4windows,代码行数:26,代码来源:Secondary.c

示例9: DriverEntry

NTSTATUS
DriverEntry (
    __in  PDRIVER_OBJECT  DriverObject,
    __in  PUNICODE_STRING RegistryPath
    )
/*++
Routine Description:

    Initialize the driver dispatch table.

Arguments:

    DriverObject - pointer to the driver object

    RegistryPath - pointer to a unicode string representing the path,
                   to driver-specific key in the registry.

Return Value:

  NT Status Code

--*/
{

    Bus_KdPrint_Def (BUS_DBG_SS_TRACE, ("Driver Entry \n"));

    //
    // Save the RegistryPath for WMI.
    //

    Globals.RegistryPath.MaximumLength = RegistryPath->Length +
                                          sizeof(UNICODE_NULL);
    Globals.RegistryPath.Length = RegistryPath->Length;
    Globals.RegistryPath.Buffer = ExAllocatePoolWithTag(
                                       PagedPool,
                                       Globals.RegistryPath.MaximumLength,
                                       BUSENUM_POOL_TAG
                                       );

    if (!Globals.RegistryPath.Buffer) {

        return STATUS_INSUFFICIENT_RESOURCES;
    }

    RtlCopyUnicodeString(&Globals.RegistryPath, RegistryPath);

    //
    // Set entry points into the driver
    //
    DriverObject->MajorFunction [IRP_MJ_CREATE] =
    DriverObject->MajorFunction [IRP_MJ_CLOSE] = Bus_CreateClose;
    DriverObject->MajorFunction [IRP_MJ_PNP] = Bus_PnP;
    DriverObject->MajorFunction [IRP_MJ_POWER] = Bus_Power;
    DriverObject->MajorFunction [IRP_MJ_DEVICE_CONTROL] = Bus_IoCtl;
    DriverObject->MajorFunction[IRP_MJ_SYSTEM_CONTROL] = Bus_SystemControl;
    DriverObject->DriverUnload = Bus_DriverUnload;
    DriverObject->DriverExtension->AddDevice = Bus_AddDevice;

    return STATUS_SUCCESS;
}
开发者ID:tigtigtig,项目名称:ndas4windows,代码行数:60,代码来源:busenum.c

示例10: _NewVolumeEntry

NTSTATUS
_NewVolumeEntry(
	_Out_ PVOLUME_ENTRY *VolumeEntry,
	_In_ PCUNICODE_STRING DosName,
	_In_ PCUNICODE_STRING DeviceName
)
{
	PVOLUME_ENTRY newEntry = NULL;
	NTSTATUS      status   = STATUS_SUCCESS;

	if (VolumeEntry == NULL) {
		DBG_ERROR("VolumeEntry cannot be null.\n");
		status = STATUS_INVALID_PARAMETER;
		goto Exit;
	}
	
	newEntry = (PVOLUME_ENTRY)MirAllocatePagedPool(sizeof(VOLUME_ENTRY));
	if (newEntry == NULL) {
		DBG_ERROR_ALLOC_FAIL(newEntry, sizeof(VOLUME_ENTRY));
		goto Exit;
	}

	InitializeListHead(&newEntry->MirrorList.ListHead);
	
	status = MirAllocateUnicodeString(&newEntry->DosName, DosName->Length);
	if (!NT_SUCCESS(status)) {
		DBG_ERROR_ALLOC_FAIL(newEntry->DosName, DosName->Length);
		MirFreePool(newEntry);
		goto Exit;
	}
	status = MirAllocateUnicodeString(&newEntry->DeviceName, DeviceName->Length);
	if (!NT_SUCCESS(status)) {
		DBG_ERROR_ALLOC_FAIL(newEntry->DeviceName, DeviceName->Length);
		MirFreeUnicodeString(&newEntry->DosName);
		MirFreePool(newEntry);
		goto Exit;
	}

	RtlCopyUnicodeString(&newEntry->DosName, DosName);
	RtlCopyUnicodeString(&newEntry->DeviceName, DeviceName);

	*VolumeEntry = newEntry;

Exit:
	return status;
}
开发者ID:jonnyyu,项目名称:MirrorFilter,代码行数:46,代码来源:volume_entry.c

示例11: myAddDevice

// 
// 实现我们自己的AddDevice函数
//
NTSTATUS myAddDevice(
					 IN PDRIVER_OBJECT  DriverObject,
					 IN PDEVICE_OBJECT  PhysicalDeviceObject 
					 )
{
	if(gDeviceObject != NULL)
	{
		// 在这里面创建我们自己的设备对象,或者申请所需要的资源。
		// 为了区分不同实例,将设备对象名构造成:”MyNdisDevice”+HardwareID。
		UNICODE_STRING nameString; 
		WCHAR wcsName[256];
		UNICODE_STRING preName = RTL_CONSTANT_STRING(L"\\Device\\MyNdisDevice");

		// 首先取得设备的HDID。
		ULONG nameLength = 0;
		WCHAR wcsHardwareID[256]; //足够大了
		NTSTATUS status = IoGetDeviceProperty (PhysicalDeviceObject,
			DevicePropertyHardwareID,
			256,
			wcsHardwareID,
			&nameLength);
		if(status != STATUS_SUCCESS){
			KdPrint(("Failed to get hardware ID %x\n", status));
			return status;
		}

		// 下面构造设备对象的名字,根据上面的规则:“MyNdisDevice”+ HardwareID。
		RtlInitEmptyUnicodeString( &nameString, wcsName, 256*2);
		RtlCopyUnicodeString( &nameString, &preName);
		//RtlUnicodeStringPrintf(&nameString, L"%wZ_%d_", &preName, 0);
		RtlAppendUnicodeToString( &nameString, wcsHardwareID);

		status = IoCreateDevice(DriverObject,
			0,
			&nameString,
			FILE_DEVICE_UNKNOWN,
			FILE_DEVICE_SECURE_OPEN,
			FALSE,
			&gDeviceObject); 

		// 如果创建失败了,我们有权利让函数以失败返回
		// 但这样我们的驱动加载也就失败了
		if(status != STATUS_SUCCESS){
			KdPrint(("Failed to create device %ws\n", nameString));
			return status;
		}
	}

	//ExAllocatePoolWithTag(); //申请资源及其他

	// 
	// 还可以加入其他正确的操作
	//

	// 现在调用保存的Ndis库中的AddDevice实现
	// 千万不要忘记,否则就会大错特错了
	return systemAddDevice(DriverObject, PhysicalDeviceObject);
}
开发者ID:340211173,项目名称:hf-2011,代码行数:61,代码来源:Hook.c

示例12: FltpGetObjectName

NTSTATUS
FltpGetObjectName(_In_ PVOID Object,
                  _Inout_ PUNICODE_STRING ObjectName)
{
    POBJECT_NAME_INFORMATION ObjectNameInfo = NULL;
    OBJECT_NAME_INFORMATION LocalNameInfo;
    ULONG ReturnLength;
    NTSTATUS Status;

    if (ObjectName == NULL)
        return STATUS_INVALID_PARAMETER;

    /* Get the size of the buffer required to hold the nameinfo */
    Status = ObQueryNameString(Object,
                              &LocalNameInfo,
                              sizeof(LocalNameInfo),
                              &ReturnLength);
    if (Status == STATUS_INFO_LENGTH_MISMATCH)
    {
        ObjectNameInfo = ExAllocatePoolWithTag(PagedPool,
                                               ReturnLength,
                                               FM_TAG_UNICODE_STRING);
        if (ObjectNameInfo == NULL) return STATUS_INSUFFICIENT_RESOURCES;

        /* Get the actual name info now we have the buffer to hold it */
        Status = ObQueryNameString(Object,
                                    ObjectNameInfo,
                                    ReturnLength,
                                    &ReturnLength);
    }


    if (NT_SUCCESS(Status))
    {
        /* Make sure the buffer we were passed is large enough to hold the string */
        if (ObjectName->MaximumLength < ObjectNameInfo->Name.Length)
        {
            /* It wasn't, let's enlarge the buffer */
            Status = FltpReallocateUnicodeString(ObjectName,
                                                 ObjectNameInfo->Name.Length,
                                                 FALSE);
            
        }

        if (NT_SUCCESS(Status))
        {
            /* Copy the object name into the callers buffer */
            RtlCopyUnicodeString(ObjectName, &ObjectNameInfo->Name);
        }
    }

    if (ObjectNameInfo)
    {
        ExFreePoolWithTag(ObjectNameInfo, FM_TAG_UNICODE_STRING);
    }

    return Status;
}
开发者ID:Strongc,项目名称:reactos,代码行数:58,代码来源:Lib.c

示例13: NtGdiOpenDCW

HDC
APIENTRY
NtGdiOpenDCW(
    PUNICODE_STRING pustrDevice,
    DEVMODEW *pdmInit,
    PUNICODE_STRING pustrLogAddr,
    ULONG iType,
    BOOL bDisplay,
    HANDLE hspool,
    VOID *pDriverInfo2,
    VOID *pUMdhpdev)
{
    UNICODE_STRING ustrDevice;
    WCHAR awcDevice[CCHDEVICENAME];
    DEVMODEW dmInit;
    PVOID dhpdev;
    HDC hdc;

    /* Only if a devicename is given, we need any data */
    if (pustrDevice)
    {
        /* Initialize destination string */
        RtlInitEmptyUnicodeString(&ustrDevice, awcDevice, sizeof(awcDevice));

        _SEH2_TRY
        {
            /* Probe the UNICODE_STRING and the buffer */
            ProbeForRead(pustrDevice, sizeof(UNICODE_STRING), 1);
            ProbeForRead(pustrDevice->Buffer, pustrDevice->Length, 1);

            /* Copy the string */
            RtlCopyUnicodeString(&ustrDevice, pustrDevice);

            if (pdmInit)
            {
                /* FIXME: could be larger */
                ProbeForRead(pdmInit, sizeof(DEVMODEW), 1);
                RtlCopyMemory(&dmInit, pdmInit, sizeof(DEVMODEW));
            }

            if (pUMdhpdev)
            {
                ProbeForWrite(pUMdhpdev, sizeof(HANDLE), 1);
            }
        }
        _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
        {
            SetLastNtError(_SEH2_GetExceptionCode());
            _SEH2_YIELD(return NULL);
        }
        _SEH2_END
    }
    else
    {
开发者ID:Nevermore2015,项目名称:reactos,代码行数:54,代码来源:dclife.c

示例14: CopyUS

PUNICODE_STRING CopyUS(PUNICODE_STRING a)
{
    PUNICODE_STRING b = (PUNICODE_STRING)ExAllocatePool(PagedPool,sizeof(UNICODE_STRING));
    ok(b != NULL, "US is NULL after allocated memory\n");
    b->Length = 0;
    b->MaximumLength =a->MaximumLength;
    b->Buffer = (PWSTR)ExAllocatePoolWithTag(PagedPool, b->MaximumLength, 1633);
    ok(b->Buffer != NULL, "US->Buffer is NULL after allocated memory\n");
    RtlCopyUnicodeString(b, a);
    return b;
}
开发者ID:Nevermore2015,项目名称:reactos,代码行数:11,代码来源:FsRtlTunnel.c

示例15: CtxUpdateNameInStreamHandleContext

NTSTATUS
CtxUpdateNameInStreamHandleContext (
    __in PUNICODE_STRING DirectoryName,
    __inout PCTX_STREAMHANDLE_CONTEXT StreamHandleContext
    )
/*++

Routine Description:

    This routine updates the name of the target in the supplied stream handle context

Arguments:

    DirectoryName             - Supplies the directory name
    StreamHandleContext   - Returns the updated name in the stream context

Return Value:

    Status

Note:

    The caller must synchronize access to the context. This routine does no
    synchronization

--*/
{
    NTSTATUS status;

    PAGED_CODE();

    //
    //  Free any existing name
    //

    if (StreamHandleContext->FileName.Buffer != NULL) {

        CtxFreeUnicodeString(&StreamHandleContext->FileName);
    }


    //
    //  Allocate and copy off the directory name
    //

    StreamHandleContext->FileName.MaximumLength = DirectoryName->Length;
    status = CtxAllocateUnicodeString(&StreamHandleContext->FileName);
    if (NT_SUCCESS(status)) {

        RtlCopyUnicodeString(&StreamHandleContext->FileName, DirectoryName);
    }

    return status;
}
开发者ID:JanD1943,项目名称:ndas4windows,代码行数:54,代码来源:context.c


注:本文中的RtlCopyUnicodeString函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。