• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ IoCreateSymbolicLink函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



在下文中一共展示了IoCreateSymbolicLink函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:JanD1943,项目名称:ndas4windows,代码行数:28,代码来源:ndasportext.c


示例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;
}
开发者ID:ShawnHuang,项目名称:footlocker,代码行数:36,代码来源:RESSDT.c


示例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;
}
开发者ID:jsc0218,项目名称:SafeMan,代码行数:33,代码来源:SSDTDriver.cpp


示例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;

}
开发者ID:ChengChengCC,项目名称:Ark-tools,代码行数:39,代码来源:DpcTimerDrv.c


示例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;
}
开发者ID:caidongyun,项目名称:libs,代码行数:67,代码来源:SECSYS.C


示例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;
}
开发者ID:7h3rAm,项目名称:Windows-Kernel-Flaws,代码行数:33,代码来源:main.c


示例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;
}
开发者ID:ChowZenki,项目名称:RetroArch,代码行数:35,代码来源:platform_xdk.c


示例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;	
}
开发者ID:icewall,项目名称:ForceDelete,代码行数:35,代码来源:core.c


示例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;
}
开发者ID:DOGSHITD,项目名称:AcpiTool,代码行数:35,代码来源:Routines.cpp


示例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!" );
    }
开发者ID:zcc1414,项目名称:windows_note,代码行数:60,代码来源:HookZwCreateFile.c


示例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;
}
开发者ID:nicolascormier,项目名称:kernel-based-malicious-code-samples,代码行数:28,代码来源:driver.c


示例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;
}
开发者ID:Artorios,项目名称:rootkit.com,代码行数:30,代码来源:handle.c


示例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;
}
开发者ID:Rizora,项目名称:RetroArch,代码行数:28,代码来源:platform_xdk.c


示例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;
}
开发者ID:340211173,项目名称:LookDrvCode,代码行数:35,代码来源:denyip.c


示例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;
}
开发者ID:MartinDrab,项目名称:VrtuleTree,代码行数:38,代码来源:driver.c


示例16: DriverEntry

NTSTATUS DriverEntry (IN PDRIVER_OBJECT DriverObject,
                      IN PUNICODE_STRING RegistryPath)
{
  UNICODE_STRING  DeviceNameUnicodeString;
  UNICODE_STRING  DeviceLinkUnicodeString;
  NTSTATUS        ntStatus;
  PDEVICE_OBJECT  DeviceObject = NULL;

  OutputDebugString ("Entering DriverEntry");

  RtlInitUnicodeString (&DeviceNameUnicodeString, L"\\Device\\WinIo");

  // Create an EXCLUSIVE device object (only 1 thread at a time
  // can make requests to this device).

  ntStatus = IoCreateDevice (DriverObject,
                             0,
                             &DeviceNameUnicodeString,
                             FILE_DEVICE_WINIO,
                             0,
                             TRUE,
                             &DeviceObject);
	
  if (NT_SUCCESS(ntStatus))
  {
    // Create dispatch points for device control, create, close.

    DriverObject->MajorFunction[IRP_MJ_CREATE]         =
    DriverObject->MajorFunction[IRP_MJ_CLOSE]          =
    DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = WinIoDispatch;
    DriverObject->DriverUnload                         = WinIoUnload;

    // Create a symbolic link, e.g. a name that a Win32 app can specify
    // to open the device.

    RtlInitUnicodeString (&DeviceLinkUnicodeString, L"\\DosDevices\\WinIo");

    ntStatus = IoCreateSymbolicLink (&DeviceLinkUnicodeString,
                                     &DeviceNameUnicodeString);

    if (!NT_SUCCESS(ntStatus))
    {
      // Symbolic link creation failed- note this & then delete the
      // device object (it's useless if a Win32 app can't get at it).

      OutputDebugString ("ERROR: IoCreateSymbolicLink failed");

      IoDeleteDevice (DeviceObject);
    }

  }
  else
  {
    OutputDebugString ("ERROR: IoCreateDevice failed");
  }

  OutputDebugString ("Leaving DriverEntry");

  return ntStatus;
}
开发者ID:JerryAi,项目名称:gamepipe-arcade-ui,代码行数:60,代码来源:WinIo.c


示例17: DriverEntry

NTSTATUS DriverEntry(PDRIVER_OBJECT driver, PUNICODE_STRING registrypath)
{
	UNICODE_STRING devicename;
	PDEVICE_OBJECT device=NULL;
	NTSTATUS status;

	DbgPrint("pbfilter:  > Entering DriverEntry()\n");

	DbgPrint("pbfilter:    setting up devicename\n");
	RtlInitUnicodeString(&devicename, NT_DEVICE_NAME);

	DbgPrint("pbfilter:    creating device\n");
	status=IoCreateDevice(driver, sizeof(PBINTERNAL), &devicename, FILE_DEVICE_PEERBLOCK, 0, FALSE, &device);

	if(NT_SUCCESS(status))
	{
		UNICODE_STRING devicelink;

		DbgPrint("pbfilter:    created device, initting internal data\n");

		DbgPrint("pbfilter:    ... creating symbolic link\n");
		RtlInitUnicodeString(&devicelink, DOS_DEVICE_NAME);
		status=IoCreateSymbolicLink(&devicelink, &devicename);

		DbgPrint("pbfilter:    ... setting up irp-handling functions\n");
		driver->MajorFunction[IRP_MJ_CREATE]=
			driver->MajorFunction[IRP_MJ_CLOSE]=drv_create;
		driver->MajorFunction[IRP_MJ_CLEANUP]=drv_cleanup;
		driver->MajorFunction[IRP_MJ_DEVICE_CONTROL]=drv_control;
		driver->DriverUnload=drv_unload;
		device->Flags|=DO_BUFFERED_IO;

		DbgPrint("pbfilter:    ... setting up device extension\n");
		g_internal=device->DeviceExtension;

		DbgPrint("pbfilter:    ... initializing lock and queue\n");
		KeInitializeSpinLock(&g_internal->rangeslock);
		KeInitializeSpinLock(&g_internal->destinationportslock);
		KeInitializeSpinLock(&g_internal->sourceportslock);
		InitNotificationQueue(&g_internal->queue);

		DbgPrint("pbfilter:    ... resetting counters\n");
		g_internal->blockedcount = 0;
		g_internal->allowedcount = 0;
		g_internal->destinationportcount = 0;
		g_internal->sourceportcount = 0;

		DbgPrint("pbfilter:    internal data initted\n");
	}

	if(!NT_SUCCESS(status))
	{
		DbgPrint("pbfilter:  * ERROR: couldn't create device, status:[0x%lX] . . . unloading\n", status);
		drv_unload(driver);
	}

	DbgPrint("pbfilter:  < Leaving DriverEntry(), status:[0x%lX]\n", status);

	return status;
}
开发者ID:Cecildt,项目名称:peerblock,代码行数:60,代码来源:filter.c


示例18: myAddDevice

NTSTATUS myAddDevice(IN PDRIVER_OBJECT DriverObject,IN PDEVICE_OBJECT pdo)
{
	PDEVICE_OBJECT fdo;
	PDEVICE_EXTENSION dve;
	NTSTATUS status;
	DbgPrint("myAddDevice routine begin");
	//Oni(h1, p85) dynamic name if device more than 1
	/*static LONG lastindex = -1;
	LONG devindex = InterlockedIncrement(&lastindex);
	WCHAR name[32]
	_snwprintf(name, arraysize(name), L"\\Device\\RAMHDD%2.2d", devindex);
	RtlInitUnicodeString(&devname, name);*/
	//??
	RtlInitUnicodeString(&DeviceName, L"\\Device\\RAMHDD");
	//creating DeviceObject
	status = IoCreateDevice(DriverObject, sizeof(DEVICE_EXTENSION), &DeviceName, FILE_DEVICE_UNKNOWN, 0, FALSE, &fdo);
	dve = (PDEVICE_EXTENSION) fdo->DeviceExtension;
	dve->DeviceObject = fdo;
	dve->Pdo = pdo;
	DbgPrint("=RAMHDD= FDO %d, DevExt=%d",fdo,dve);
	RtlInitUnicodeString(&SymbolicLinkName, L"\\Device\\RAMHDD");
	dve->ifname =  SymbolicLinkName;
	status = IoCreateSymbolicLink(&SymbolicLinkName, &DeviceName);
	//IoInitializeRemoveLock(&dve->RemoveLock, 0, 0, 0);
	//dve->devstate = STATE_INITIALIZED;
	//IoInitializeDpcRequest(fdo, DpcForIsr);
	fdo->Flags = DO_DIRECT_IO | DO_POWER_PAGABLE;
	dve->LowerDeviceObject = IoAttachDeviceToDeviceStack(fdo, pdo);
	fdo->Flags &= ~DO_DEVICE_INITIALIZING;
	DbgPrint("myAddDevice routine end");
	return STATUS_SUCCESS;
}
开发者ID:bsuir850505pilitsin,项目名称:course-project,代码行数:32,代码来源:harddrive.cpp


示例19: create_device

NTSTATUS create_device(PDRIVER_OBJECT driverObject, PCWSTR name, PCWSTR dosName) {
	NTSTATUS status = STATUS_SUCCESS;
	PDEVICE_OBJECT deviceObject = NULL;

	UNICODE_STRING deviceName;
	RtlInitUnicodeString(&deviceName, name);
	status = IoCreateDevice(driverObject,
							0,
							&deviceName,
							FILE_DEVICE_UNKNOWN,
							FILE_DEVICE_SECURE_OPEN,
							FALSE,
							&deviceObject);
	if (status != STATUS_SUCCESS) {
		DbgPrint("Cannot create device\n");
		goto cleanup;
	}
	DbgPrint("%wZ: 0x%08X\n", &deviceName, deviceObject);

	deviceObject->Flags |= DO_BUFFERED_IO;
	deviceObject->Flags &= (~DO_DEVICE_INITIALIZING);

	UNICODE_STRING dosDeviceName;
	RtlInitUnicodeString(&dosDeviceName, dosName);
	IoCreateSymbolicLink(&dosDeviceName, &deviceName);

cleanup:
	if (status != STATUS_SUCCESS) {
		if (deviceObject) {
			IoDeleteDevice(deviceObject);
		}
	}
	return status;
}
开发者ID:jlguenego,项目名称:sandbox,代码行数:34,代码来源:driver.c


示例20: WdmAudRegisterDeviceInterface

NTSTATUS
WdmAudRegisterDeviceInterface(
    IN PDEVICE_OBJECT PhysicalDeviceObject,
    IN PWDMAUD_DEVICE_EXTENSION DeviceExtension)
{
    NTSTATUS Status;
    UNICODE_STRING SymlinkName = RTL_CONSTANT_STRING(L"\\DosDevices\\wdmaud");
    UNICODE_STRING DeviceName = RTL_CONSTANT_STRING(L"\\Device\\wdmaud");
    UNICODE_STRING SymbolicLinkName;

    Status = IoRegisterDeviceInterface(PhysicalDeviceObject, &KSCATEGORY_WDMAUD, NULL, &SymbolicLinkName);
    if (NT_SUCCESS(Status))
    {
        IoSetDeviceInterfaceState(&SymbolicLinkName, TRUE);
        RtlFreeUnicodeString(&SymbolicLinkName);
        DeviceExtension->DeviceInterfaceSupport = TRUE;
        return Status;
    }

    /* failed to register device interface
     * create a symbolic link instead 
     */
    DeviceExtension->DeviceInterfaceSupport = FALSE;

    Status = IoCreateSymbolicLink(&SymlinkName, &DeviceName);
    if (!NT_SUCCESS(Status))
    {
        IoDeleteDevice(PhysicalDeviceObject); //FIXME
        DPRINT("Failed to create wdmaud symlink!\n");
        return Status;
    }

    return Status;
}
开发者ID:HBelusca,项目名称:NasuTek-Odyssey,代码行数:34,代码来源:deviface.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ IoDeleteDevice函数代码示例发布时间:2022-05-30
下一篇:
C++ IoCreateDevice函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap