⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ramdisk.h

📁 wince ramdisk drivers
💻 H
字号:
//
// Copyright (c) Microsoft Corporation.  All rights reserved.
//
//
// Use of this source code is subject to the terms of the Microsoft end-user
// license agreement (EULA) under which you licensed this SOFTWARE PRODUCT.
// If you did not accept the terms of the EULA, you are not authorized to use
// this source code. For a copy of the EULA, please see the LICENSE.RTF on your
// install media.
//
/*++
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.

Module Name:  

    ramdisk.h

Abstract:  

    This module contains the function prototypes and constant, type,
    global data and structure definitions for the Windows CE RAM disk driver.

Functions:

Notes:


--*/

#ifndef _RAMDISK_H_
#define _RAMDISK_H_

#include <windows.h>
#include <types.h>
#include <excpt.h>
#include <tchar.h>
#include <devload.h>
#include <diskio.h>
#include <storemgr.h>


#ifdef __cplusplus
extern "C" {
#endif

#define RD_SIZE 0x00100000
#define BYTES_PER_SECTOR 512

//
// Device states - To guard against races during trasitions to and from
// standby mode, a disk starts in the STATE_INITING state.  Upon entering
// standby mode, a disk goes into the STATE_DEAD state and can no longer
// be used.  Coming out of standby mode, the pcmcia system will force a card
// removal and this driver will get unloaded.  Between the time the device has
// left standby mode and the card removal notice gets generated, the disk 
// should not be used at all, since as the driver is unloading it unmaps the
// memory windows to pcmcia common memory space.
//
#define STATE_INITING 1
#define STATE_CLOSED  2
#define STATE_OPENED  3
#define STATE_DEAD    4    // Power down
#define STATE_REMOVED 5

#define DISK_DEAD_ERROR     ERROR_NOT_READY
#define DISK_REMOVED_ERROR  ERROR_BAD_UNIT

//
// Structure to keep track of a disk.  NUM_MEM_WINDOWS are maintained and
// remapped as needed.  One of these will remain fixed at location 0 to make
// FAT file system faster (the FAT is at the beginning of the disk).
//
typedef struct _DISK {
    struct _DISK * d_next;
    CRITICAL_SECTION d_DiskCardCrit;// guard access to global state and card
    DWORD d_DiskCardState;
    DISK_INFO d_DiskInfo;    // for DISK_IOCTL_GET/SETINFO
    DWORD d_OpenCount;    // open ref count
    PBYTE pbRAM;
    LPWSTR d_ActivePath;    // registry path to active key for this device
} DISK, * PDISK; 

//
// Global Variables
//
extern CRITICAL_SECTION v_DiskCrit;    // guard access to disk structure list
extern PDISK v_DiskList;


//
// Global functions
//
DWORD DoDiskIO(PDISK pDisk, DWORD Opcode, PSG_REQ pSG);
DWORD GetDiskInfo(PDISK pDisk, PDISK_INFO pInfo);
DWORD SetDiskInfo(PDISK pDisk, PDISK_INFO pInfo);
DWORD GetDiskStateError(DWORD DiskState);
VOID CloseDisk(PDISK pDisk);
BOOL GetFolderName(PDISK pDisk, LPWSTR pOutBuf, DWORD nOutBufSize, DWORD * pBytesReturned);
BOOL GetDeviceInfo(PDISK pDisk, PSTORAGEDEVICEINFO pInfo);
DWORD GetDiskSize(PDISK pDisk);
DWORD GetDiskAddress(PDISK pDisk);

#ifdef DEBUG
//
// Debug zones
//
#define ZONE_ERROR      DEBUGZONE(0)
#define ZONE_WARNING    DEBUGZONE(1)
#define ZONE_FUNCTION   DEBUGZONE(2)
#define ZONE_INIT       DEBUGZONE(3)
#define ZONE_PCMCIA     DEBUGZONE(4)
#define ZONE_IO         DEBUGZONE(5)
#define ZONE_MISC       DEBUGZONE(6)

#endif  // DEBUG

#ifdef __cplusplus
}
#endif

#endif // _RAMDISK_H_

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -