本文整理汇总了C++中IoCreateSymbolicLink函数的典型用法代码示例。如果您正苦于以下问题:C++ IoCreateSymbolicLink函数的具体用法?C++ IoCreateSymbolicLink怎么用?C++ IoCreateSymbolicLink使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IoCreateSymbolicLink函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: NdasPortExtRegisterExternalTypes
NTSTATUS
NdasPortExtRegisterExternalTypes(
__in PCUNICODE_STRING DeviceName,
__in CONST GUID* ExternalTypeGuid,
__inout PUNICODE_STRING SymbolicLinkName)
{
NTSTATUS status;
status = NdasPortExtBuildSymbolicLinkName(
SymbolicLinkName,
ExternalTypeGuid);
if (!NT_SUCCESS(status))
{
return status;
}
status = IoCreateSymbolicLink(
SymbolicLinkName,
(PUNICODE_STRING) DeviceName);
if (!NT_SUCCESS(status))
{
return status;
}
return STATUS_SUCCESS;
}
示例2: DriverEntry
//StartService时调用
NTSTATUS DriverEntry( IN PDRIVER_OBJECT theDriverObject, IN PUNICODE_STRING theRegistryPath )
{
NTSTATUS status=STATUS_SUCCESS;
ULONG i;
__asm
{
pushad
xor eax, ebx
sub ebx, ecx
add ecx, edx
xor ebx, eax
popad
}
for(i= 0;i<IRP_MJ_MAXIMUM_FUNCTION;++i)
theDriverObject->MajorFunction[i] = DisPatchCreateClose;
theDriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL]=DispatchDeviceControl;
theDriverObject->DriverUnload=DriverUnload;
RtlInitUnicodeString(&DerName,L"\\Device\\RESSDT");
status=IoCreateDevice(theDriverObject,0,&DerName,FILE_DEVICE_UNKNOWN,0,FALSE,&pDevObj);
if(!NT_SUCCESS(status))
{
//DbgPrint("IoCreateDevice Fail!");
return status;
}
RtlInitUnicodeString(&DerName2,L"\\??\\RESSDTDOS");
status=IoCreateSymbolicLink(&DerName2,&DerName);
// if(!NT_SUCCESS(status))
// DbgPrint("IoCreateSymbolicLink fail!");
return status;
}
示例3: CreateDevice
NTSTATUS CreateDevice(IN PDRIVER_OBJECT pDriverObject)
{
// 创建设备名称
UNICODE_STRING devName;
RtlInitUnicodeString(&devName, L"\\Device\\SSDTDriver");
// 创建设备
PDEVICE_OBJECT pDevObj;
NTSTATUS status = IoCreateDevice(pDriverObject,
sizeof(DEVICE_EXTENSION),
&devName,
FILE_DEVICE_UNKNOWN,
0,
TRUE,
&pDevObj);
if (!NT_SUCCESS(status))
{
return status;
}
PDEVICE_EXTENSION pDevExt = (PDEVICE_EXTENSION)pDevObj->DeviceExtension;
//创建符号链接
UNICODE_STRING symLinkName;
RtlInitUnicodeString(&symLinkName, L"\\??\\SSDTDriver");
status = IoCreateSymbolicLink(&symLinkName, &devName);
if (!NT_SUCCESS(status))
{
IoDeleteDevice(pDevObj);
return status;
}
return STATUS_SUCCESS;
}
示例4: DriverEntry
//#######################################################################################
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@ D R I V E R E N T R Y P O I N T @@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//#######################################################################################
NTSTATUS
DriverEntry(IN PDRIVER_OBJECT DriverObject, IN PUNICODE_STRING RegistryString)
{
NTSTATUS Status;
UNICODE_STRING uniDeviceName;
UNICODE_STRING uniLinkName;
ULONG_PTR i = 0;
PDEVICE_OBJECT DeviceObject = NULL;
RtlInitUnicodeString(&uniDeviceName,DEVICE_NAME);
RtlInitUnicodeString(&uniLinkName,LINK_NAME);
for (i=0;i<IRP_MJ_MAXIMUM_FUNCTION;i++)
{
DriverObject->MajorFunction[i] = DefaultDispatchFunction;
}
DriverObject->DriverUnload = UnloadDriver;
DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = DispatchControl;
//创建设备对象
Status = IoCreateDevice(DriverObject,0,&uniDeviceName,FILE_DEVICE_UNKNOWN,0,FALSE,&DeviceObject);
if (!NT_SUCCESS(Status))
{
return STATUS_UNSUCCESSFUL;
}
Status = IoCreateSymbolicLink(&uniLinkName,&uniDeviceName);
if (!NT_SUCCESS(Status))
{
IoDeleteDevice(DeviceObject);
return STATUS_UNSUCCESSFUL;
}
g_DriverObject = DriverObject;
return STATUS_SUCCESS;
}
示例5: DriverEntry
//----------------------------------------------------------------------
//
// DriverEntry
//
// Installable driver initialization. Here we just set ourselves up.
//
//----------------------------------------------------------------------
NTSTATUS DriverEntry(IN PDRIVER_OBJECT DriverObject, IN PUNICODE_STRING RegistryPath )
{
PDEVICE_OBJECT GUIDevice;
NTSTATUS ntStatus;
WCHAR deviceNameBuffer[] = L"\\Device\\Secsys";
UNICODE_STRING deviceNameUnicodeString;
WCHAR deviceLinkBuffer[] = L"\\DosDevices\\Secsys";
UNICODE_STRING deviceLinkUnicodeString;
DbgPrint (("Secsys.sys: entering DriverEntry\n"));
//
// setup our name
//
RtlInitUnicodeString (&deviceNameUnicodeString,
deviceNameBuffer );
//
// set up the device used for GUI communications
ntStatus = IoCreateDevice ( DriverObject,
0,
&deviceNameUnicodeString,
FILE_DEVICE_SECDEMO,
0,
FALSE,
&GUIDevice );
if (NT_SUCCESS(ntStatus)) {
//
// Create a symbolic link that the GUI can specify to gain access
// to this driver/device
//
RtlInitUnicodeString (&deviceLinkUnicodeString,
deviceLinkBuffer );
ntStatus = IoCreateSymbolicLink (&deviceLinkUnicodeString,
&deviceNameUnicodeString );
if (!NT_SUCCESS(ntStatus))
DbgPrint (("Secsys.sys: IoCreateSymbolicLink failed\n"));
//
// Create dispatch points for all routines that must be Secsysd
//
DriverObject->MajorFunction[IRP_MJ_CREATE] =
DriverObject->MajorFunction[IRP_MJ_CLOSE] =
DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = SecsysDispatch;
DriverObject->DriverUnload = SecsysUnload;
} else {
DbgPrint(("Secsys: Failed to create our device!\n"));
//
// Something went wrong, so clean up (free resources etc)
//
if( GUIDevice ) IoDeleteDevice( GUIDevice );
return ntStatus;
}
return ntStatus;
}
示例6: DriverEntry
NTSTATUS DriverEntry(PDRIVER_OBJECT pDriverObj , PUNICODE_STRING pRegistryPath)
{
DWORD i = 0;
NTSTATUS status;
UNICODE_STRING deviceName = {0}, symlinkName = {0};
PDEVICE_OBJECT pDevice = NULL;
pDriverObj->DriverUnload = Unload;
DbgPrint("[ Loading.. ]\r\n");
RtlInitUnicodeString(&deviceName, L"\\Device\\2");
RtlInitUnicodeString(&symlinkName, L"\\DosDevices\\2");
DbgPrint("[ Creating the device...]\n");
IoCreateDevice(
pDriverObj,
0,
&deviceName,
FILE_DEVICE_UNKNOWN,
FILE_DEVICE_SECURE_OPEN,
FALSE,
&pDevice
);
DbgPrint("[ Linking...]\n");
IoCreateSymbolicLink(&symlinkName, &deviceName);
for(; i < IRP_MJ_MAXIMUM_FUNCTION; i++)
pDriverObj->MajorFunction[i] = handleIRP;
pDriverObj->MajorFunction[IRP_MJ_DEVICE_CONTROL] = handleIOCTLs;
return STATUS_SUCCESS;
}
示例7: xbox_io_mount
static HRESULT xbox_io_mount(char *szDrive, char *szDevice)
{
#ifndef IS_SALAMANDER
bool original_verbose = g_extern.verbose;
g_extern.verbose = true;
#endif
char szSourceDevice[48];
char szDestinationDrive[16];
snprintf(szSourceDevice, sizeof(szSourceDevice), "\\Device\\%s", szDevice);
snprintf(szDestinationDrive, sizeof(szDestinationDrive), "\\??\\%s", szDrive);
RARCH_LOG("xbox_io_mount() - source device: %s.\n", szSourceDevice);
RARCH_LOG("xbox_io_mount() - destination drive: %s.\n", szDestinationDrive);
STRING DeviceName =
{
strlen(szSourceDevice),
strlen(szSourceDevice) + 1,
szSourceDevice
};
STRING LinkName =
{
strlen(szDestinationDrive),
strlen(szDestinationDrive) + 1,
szDestinationDrive
};
IoCreateSymbolicLink(&LinkName, &DeviceName);
#ifndef IS_SALAMANDER
g_extern.verbose = original_verbose;
#endif
return S_OK;
}
示例8: DriverEntry
NTSTATUS DriverEntry( IN PDRIVER_OBJECT pDriverObject, IN PUNICODE_STRING theRegistryPath )
{
NTSTATUS ntStatus;
PDEVICE_OBJECT mnhmod;
UNICODE_STRING uDriverName;
UNICODE_STRING uSymLink;
RtlInitUnicodeString(&uDriverName,driverName);
RtlInitUnicodeString(&uSymLink,symLink);
ntStatus = IoCreateDevice(pDriverObject,
0,
&uDriverName,
MANHATAN_MOD,
0,
TRUE,
&mnhmod);
if(ntStatus != STATUS_SUCCESS)
{
DbgPrint("ManhatanMod error");
return 0;
}
DbgPrint("ManhatanMod loaded successful");
//create symlink
IoCreateSymbolicLink(&uSymLink,&uDriverName);
pDriverObject->DriverUnload = OnUnload;
pDriverObject->MajorFunction[IRP_MJ_SHUTDOWN] =
pDriverObject->MajorFunction[IRP_MJ_CREATE] =
pDriverObject->MajorFunction[IRP_MJ_CLOSE] =
pDriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = Dispatch_IRP_Routine;
return ntStatus;
}
示例9: CreateDevice
NTSTATUS CreateDevice (IN PDRIVER_OBJECT pDriverObject)
{
NTSTATUS status;
PDEVICE_OBJECT pDevObj;
PDEVICE_EXTENSION pdx;
UNICODE_STRING devName;
RtlInitUnicodeString(&devName,DEVICE_NAME);
status = IoCreateDevice( pDriverObject,sizeof(DEVICE_EXTENSION),&(UNICODE_STRING)devName,FILE_DEVICE_ACPI,0, TRUE,&pDevObj );
if (!NT_SUCCESS(status))
{
////KdPrint(("IoCreateDevice Failed EC=0x%lX\n",status));
}else
{
////KdPrint(("IoCreateDevice OK\n"));
pDevObj->Flags |= DO_BUFFERED_IO;
pdx = (PDEVICE_EXTENSION)pDevObj->DeviceExtension;
g_pdx=pdx;
RtlZeroMemory(pdx,sizeof(DEVICE_EXTENSION));
pdx->pDevice = pDevObj;
pdx->ustrDeviceName = devName;
UNICODE_STRING symLinkName;
RtlInitUnicodeString(&symLinkName,SYMBOLINK_NAME);
pdx->ustrSymLinkName = symLinkName;
status = IoCreateSymbolicLink( &symLinkName,&devName );
if (!NT_SUCCESS(status))
{
////KdPrint(("IoCreateSymbolicLink Failed EC=0x%lX\n",status));
IoDeleteDevice( pDevObj );
}else
{
////KdPrint(("IoCreateSymbolicLink OK\n"));
}
}
return status;
}
示例10: DriverEntry
NTSTATUS DriverEntry( PDRIVER_OBJECT pDriverObject,
PUNICODE_STRING pRegistryPath )
{
PDEVICE_OBJECT pdo = NULL;
NTSTATUS s = STATUS_SUCCESS;
UNICODE_STRING usDriverName, usDosDeviceName;
RtlInitUnicodeString( &usDriverName, DRIVER_NAME );
RtlInitUnicodeString( &usDosDeviceName, DEVICE_NAME );
s = IoCreateDevice( pDriverObject, 0, &usDriverName, \
FILE_DRIVER_SSDT, FILE_DEVICE_SECURE_OPEN, \
FALSE, &pdo );
if( STATUS_SUCCESS == s )
{
pDriverObject->MajorFunction[IRP_MJ_CREATE] = SSDTCreate;
pDriverObject->DriverUnload = SSDTUnload;
pDriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] \
= SSDTDeviceIoCtl;
IoCreateSymbolicLink( &usDosDeviceName, &usDriverName );
DbgPrint( "SSDT: Load Success!" );
DbgPrint( "SSDT: Hook ZwCreateFile Prepare!" );
////////////////////////////////////////////////////////////////////
// 开始HOOK ZwWriteFile
//去掉内存保护
__asm
{
cli ;//关中断
mov eax, cr0
and eax, ~0x10000
mov cr0, eax
}
//保存原始值
(ULONG)OldZwCreateFile = \
*( (PULONG)(KeServiceDescriptorTable->pvSSDTBase) + \
(ULONG)HOOK_SSDT_NUMBER );
//修改SSDT中的 ZwWriteFile 指向新函数
*( (PULONG)(KeServiceDescriptorTable->pvSSDTBase) + \
(ULONG)HOOK_SSDT_NUMBER ) \
= (ULONG)NewZwCreateFile;
//开中断,把内存保护加上
__asm
{
mov eax, cr0
or eax, 0x10000
mov cr0, eax
sti ;//开中断
}
///////////////////////////////// HOOK 完成
DbgPrint( "SSDT: Hook ZwCreateFile Success!" );
}
示例11: DriverEntry
NTSTATUS DriverEntry(PDRIVER_OBJECT driverObject, PUNICODE_STRING registryPath)
{
PDEVICE_OBJECT pDeviceObject = NULL;
UNICODE_STRING DeviceName;
UNICODE_STRING DosDeviceName;
NTSTATUS NtStatus;
DbgPrint("DriverEntry ...");
RtlInitUnicodeString(&DeviceName, deviceNameBuffer);
RtlInitUnicodeString(&DosDeviceName,deviceLinkBuffer);
NtStatus = IoCreateDevice(driverObject, 0, &DeviceName, FILE_DEVICE_UNKNOWN, FILE_DEVICE_SECURE_OPEN, FALSE, &pDeviceObject);
if(!NT_SUCCESS(NtStatus)) return NtStatus;
NtStatus = IoCreateSymbolicLink(&DosDeviceName, &DeviceName);
if(!NT_SUCCESS(NtStatus))
{
IoDeleteDevice(driverObject->DeviceObject);
return NtStatus;
}
driverObject->MajorFunction[IRP_MJ_CREATE] = Irp_Nil;
driverObject->MajorFunction[IRP_MJ_CLOSE] = Irp_Nil;
driverObject->MajorFunction[IRP_MJ_WRITE] = Irp_Write;
driverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = Irp_Nil;
driverObject->MajorFunction[IRP_MJ_SHUTDOWN] = Irp_Nil;
driverObject->DriverUnload = DriverUnload;
return STATUS_SUCCESS;
}
示例12: DriverEntry
NTSTATUS DriverEntry(IN PDRIVER_OBJECT DriverObject,
IN PUNICODE_STRING RegistryPath)
{
UNICODE_STRING ntDeviceName;
UNICODE_STRING win32DeviceName;
NTSTATUS status;
RtlInitUnicodeString(&ntDeviceName,NT_DEVICE_NAME);
if (!NT_SUCCESS(status = IoCreateDevice(DriverObject,0,&ntDeviceName,
FILE_DEVICE_UNKNOWN,0,FALSE,
&HwndNameDriverDeviceObject)))
return STATUS_NO_SUCH_DEVICE;
HwndNameDriverDeviceObject->Flags |= DO_BUFFERED_IO;
RtlInitUnicodeString(&win32DeviceName,DOS_DEVICE_NAME);
if (!NT_SUCCESS(status = IoCreateSymbolicLink(&win32DeviceName,
&ntDeviceName)))
return STATUS_NO_SUCH_DEVICE;
DriverObject->MajorFunction[IRP_MJ_CREATE ] = HwndNameDriverIO;
DriverObject->MajorFunction[IRP_MJ_CLOSE ] = HwndNameDriverIO;
DriverObject->MajorFunction[IRP_MJ_READ ] = HwndNameDriverIO;
DriverObject->MajorFunction[IRP_MJ_WRITE ] = HwndNameDriverIO;
DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = HwndNameDriverIOControl;
DriverObject->DriverUnload = HwndNameDriverUnload;
return STATUS_SUCCESS;
}
示例13: xbox_io_mount
static HRESULT xbox_io_mount(char *szDrive, char *szDevice)
{
char szSourceDevice[48];
char szDestinationDrive[16];
snprintf(szSourceDevice, sizeof(szSourceDevice), "\\Device\\%s", szDevice);
snprintf(szDestinationDrive, sizeof(szDestinationDrive), "\\??\\%s", szDrive);
RARCH_LOG("xbox_io_mount() - source device: %s.\n", szSourceDevice);
RARCH_LOG("xbox_io_mount() - destination drive: %s.\n", szDestinationDrive);
STRING DeviceName =
{
strlen(szSourceDevice),
strlen(szSourceDevice) + 1,
szSourceDevice
};
STRING LinkName =
{
strlen(szDestinationDrive),
strlen(szDestinationDrive) + 1,
szDestinationDrive
};
IoCreateSymbolicLink(&LinkName, &DeviceName);
return S_OK;
}
示例14: DriverEntry
NTSTATUS DriverEntry(PDRIVER_OBJECT driverObject, PUNICODE_STRING registryPath)
{
UNICODE_STRING deviceName = {0};
UNICODE_STRING deviceDosName = {0};
NTSTATUS status = STATUS_SUCCESS;
driverObject->DriverUnload = DriverUnload;
RtlInitUnicodeString( &deviceName,DEVICE_NAME );
status = IoCreateDevice( driverObject,
0,
&deviceName,
FILE_DEVICE_NETWORK,
0,
FALSE,
&gDevObj );
if( !NT_SUCCESS(status))
{
DbgPrint("[WFP_TEST]IoCreateDevice failed!\n");
return STATUS_UNSUCCESSFUL;
}
RtlInitUnicodeString( &deviceDosName,DEVICE_DOSNAME );
status = IoCreateSymbolicLink( &deviceDosName,&deviceName );
if( !NT_SUCCESS( status ))
{
DbgPrint("[WFP_TEST]Create Symbolink name failed!\n");
return STATUS_UNSUCCESSFUL;
}
status = WallRegisterCallouts();
if( !NT_SUCCESS( status ))
{
DbgPrint("[WFP_TEST]WallRegisterCallouts failed!\n");
return STATUS_UNSUCCESSFUL;
}
DbgPrint("[WFP_TEST] loaded! WallRegisterCallouts() success!\n");
return status;
}
示例15: DriverInit
/** Creates a communication device for the driver. The device is then used
* by user mode application in order to collect snapshots of drivers and
* devices present in the system. The routine also sets up the DriverUnload
* procedure.
*
* @param DriverObject Address of Driver Object structure, passed by the
* system into DriverEntry.
*
* @return
* Returns NTSTATUS value indicating success or failure of the operation.
*/
static NTSTATUS DriverInit(PDRIVER_OBJECT DriverObject)
{
UNICODE_STRING uDeviceName;
NTSTATUS status = STATUS_UNSUCCESSFUL;
DEBUG_ENTER_FUNCTION("DriverObject=0x%p", DriverObject);
RtlInitUnicodeString(&uDeviceName, DRIVER_DEVICE);
status = IoCreateDevice(DriverObject, 0, &uDeviceName, FILE_DEVICE_UNKNOWN, 0, FALSE, &DriverObject->DeviceObject);
if (NT_SUCCESS(status)) {
UNICODE_STRING uLinkName;
RtlInitUnicodeString(&uLinkName, DRIVER_SYMLINK);
status = IoCreateSymbolicLink(&uLinkName, &uDeviceName);
if (NT_SUCCESS(status)) {
DriverObject->DriverUnload = DriverUnload;
DriverObject->MajorFunction[IRP_MJ_CREATE] = DriverCreateClose;
DriverObject->MajorFunction[IRP_MJ_CLOSE] = DriverCreateClose;
DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = DriverDeviceControl;
}
if (!NT_SUCCESS(status))
IoDeleteDevice(DriverObject->DeviceObject);
}
DEBUG_EXIT_FUNCTION("0x%x", status);
return status;
}