?? usbstor.c
字號:
/*++
Copyright (c) 1999 Microsoft Corporation
Module Name:
USBSTOR.c
Abstract:
IOS port driver for USB LS-120 drive
Main module
Environment:
kernel mode only
Notes:
THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
PURPOSE.
Copyright (c) 1999 Microsoft Corporation. All Rights Reserved.
Revision History:
03/19/99: MRB Original
--*/
#define WANTVXDWRAPS
#include <basedef.h>
#include <vmm.h>
#include <debug.h>
#include <vxdwraps.h>
#include <winerror.h>
#include <drp.h>
#include <ilb.h>
#include <aep.h>
#include <ios.h>
#include <ior.h>
#include <iop.h>
#include <vxdldr.h>
#include "usbdebug.h"
#include "usbstor.h"
#pragma VxD_LOCKED_DATA_SEG
// Structure containing entrypoints for IOS services
ILB USBSTOR_Ilb;
// Pointers to exported functions in USBLS120.SYS
USBSTOR_GETNEXTPDO pfnGetNextPdo;
USBSTOR_STARTREQUEST pfnStartRequest;
USBSTOR_REGISTERHANDLER pfnRegisterCompletionHandler;
#pragma VxD_IDATA_SEG
// IOS driver registration packet for this port driver
DRP Drv_Reg_Pkt = {
"XXXXXXXX",
DRP_MISC_PD,
USBSTOR_AER,
&USBSTOR_Ilb,
USBStorName,
USBStorRev,
USBStorFeature,
DRP_IF_STD,
DRP_BT_SCSI,
0,
0,
"00",
0
};
#pragma VxD_ICODE_SEG
#pragma VxD_IDATA_SEG
DWORD _stdcall
USBSTOR_Dynamic_Init(
void
)
/*++
Routine Description:
VxD dynamic initialization routine, called when the port driver
is dynamically loaded by IOS. This function lies in an init-only
code segment, and will be discarded after initialization
completes.
Arguments:
None
Return Value:
VXD_SUCCESS if successful,
VXD_FAILURE otherwise
--*/
{
HPEMODULE hWdmMod;
USBSTOR_DebugPrintf(DBG_DEFAULT, ("Dynamic Init\n\r"));
// Get module handle for USBLS120.SYS WDM/USB driver
hWdmMod = _PELDR_GetModuleHandle("USBLS120.SYS");
// Fail if USBLS120.SYS is not loaded
if (!hWdmMod)
return (VXD_FAILURE);
// Get the addresses of the functions exported by USBSTOR.SYS
pfnGetNextPdo = (USBSTOR_GETNEXTPDO) _PELDR_GetProcAddress(hWdmMod, "USBLS120_GetNextPDO",0);
pfnRegisterCompletionHandler = (USBSTOR_REGISTERHANDLER) _PELDR_GetProcAddress(hWdmMod, "USBLS120_RegisterCompletionHandler",0);
pfnStartRequest = (USBSTOR_STARTREQUEST) _PELDR_GetProcAddress(hWdmMod, "USBLS120_StartRequest",0);
// Fail if we can't find the exported functions
if (!pfnGetNextPdo || !pfnRegisterCompletionHandler || !pfnStartRequest)
return (VXD_FAILURE);
// Register our driver with IOS
IosRegister(&Drv_Reg_Pkt);
return(VXD_SUCCESS);
}
#pragma VxD_LOCKED_CODE_SEG
#pragma VxD_LOCKED_DATA_SEG
DWORD _stdcall
USBSTOR_Dynamic_Exit(
void
)
/*++
Routine Description:
VxD dynamic exit routine
Arguments:
None
Return Value:
VXD_SUCCESS if successful,
VXD_FAILURE otherwise
--*/
{
USBSTOR_DebugPrintf(DBG_DEFAULT, ("Dynamic Exit\n\r"));
return(VXD_SUCCESS);
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -