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

📄 myopensource.h

📁 A small tool for grab all resources from WM devices. Can be used for localization and create MUI fil
💻 H
📖 第 1 页 / 共 2 页
字号:
};

// REFINFO - reference info for Handle Data.
typedef struct FULLREF {
    ushort  usRefs[MAX_PROCESSES];
} FULLREF;
typedef union REFINFO {
    ulong   count;
    FULLREF *pFr;
} REFINFO;

// HDATA - handle data structure
typedef struct _HDATA HDATA, *PHDATA;
struct _HDATA {
    DList       linkage;    /* 00: links for active handle list */
    HANDLE      hValue;     /* 08: Current value of handle (nonce) */
    ACCESSLOCK  lock;       /* 0C: access information */
    REFINFO     ref;        /* 10: reference information */
    const CINFO *pci;       /* 14: ptr to object class description structure */
    PVOID       pvObj;      /* 18: ptr to object */
    DWORD       dwInfo;     /* 1C: extra handle info */
};                          /* 20: sizeof(HDATA) */

/* Memory Block
 *   This structure maps a 64K block of memory. All memory reservations
 * must begin on a 64k boundary.
 */
struct MemBlock {
    ACCESSLOCK  alk;        /* 00: key code for this set of pages */
    uchar       cUses;      /* 04: # of page table entries sharing this leaf */
    uchar       flags;      /* 05: mapping flags */
    short       ixBase;     /* 06: first block in region */
    short       hPf;        /* 08: handle to pager */
    short       cLocks;     /* 0a: lock count */
    ulong       aPages[PAGES_PER_BLOCK]; /* 12: entrylo values */
}; /* MemBlock */

typedef struct {
    WORD wPool;
    WCHAR name[MAX_PATH];   /* name of item */
} WNAME, * LPWNAME; // Name, * LPName; // Name - is too common name  ( Dubovsky comment )

typedef struct EVENT {
    HANDLE hNext;           /* Next event in list */
    LPPROXY pProxList;
    LPPROXY pProxHash[PRIORITY_LEVELS_HASHSIZE];
    BYTE onequeue;
    BYTE state;             /* TRUE: signalled, FALSE: unsignalled */
    BYTE manualreset;       /* TRUE: manual reset, FALSE: autoreset */
    BYTE bMaxPrio;
    WNAME *name;            /* 0x50: points to name of event */
    LPPROXY pIntrProxy;
} EVENT;


//---------------------------------------------------------------------------

struct KDataStruct {
    LPDWORD lpvTls;         /* 0x000 Current thread local storage pointer */
    HANDLE  ahSys[NUM_SYS_HANDLES]; /* 0x004 If this moves, change kapi.h */
    char    bResched;       /* 0x084 reschedule flag */
    char    cNest;          /* 0x085 kernel exception nesting */
    char    bPowerOff;      /* 0x086 TRUE during "power off" processing */
    char    bProfileOn;     /* 0x087 TRUE if profiling enabled */
    ulong   ptDesc;         /* 0x088 Page Table Descriptor */
    ulong   rsvd2;          /* 0x08c was DiffMSec */
    PPROCESS pCurPrc;       /* 0x090 ptr to current PROCESS struct */
    PTHREAD pCurThd;        /* 0x094 ptr to current THREAD struct */
    DWORD   dwKCRes;        /* 0x098  */
    ulong   handleBase;     /* 0x09c handle table base address */
    PSECTION aSections[64]; /* 0x0a0 section table for virutal memory */
    LPEVENT alpeIntrEvents[SYSINTR_MAX_DEVICES];/* 0x1a0 */
    LPVOID  alpvIntrData[SYSINTR_MAX_DEVICES];  /* 0x220 */
    ulong   pAPIReturn;     /* 0x2a0 direct API return address for kernel mode */
    uchar   *pMap;          /* 0x2a4 ptr to MemoryMap array */
    DWORD   dwInDebugger;   /* 0x2a8 !0 when in debugger */

    long    alPad[21];      /* 0x2ac - padding */
    DWORD   aInfo[32];      /* 0x300 - misc. kernel info */
                            /* 0x380 - interlocked api code */
                            /* 0x400 - end */
};  /* KDataStruct */

// From NkARM.h
/* High memory layout
 *
 * This structure is mapped in at the end of the 4GB virtual
 * address space.
 *
 *  0xFFFD0000 - first level page table (uncached) (2nd half is r/o)
 *  0xFFFD4000 - disabled for protection
 *  0xFFFE0000 - second level page tables (uncached)
 *  0xFFFE4000 - disabled for protection
 *  0xFFFF0000 - exception vectors
 *  0xFFFF0400 - not used (r/o)
 *  0xFFFF1000 - disabled for protection
 *  0xFFFF2000 - r/o (physical overlaps with vectors)
 *  0xFFFF2400 - Interrupt stack (1k)
 *  0xFFFF2800 - r/o (physical overlaps with Abort stack & FIQ stack)
 *  0xFFFF3000 - disabled for protection
 *  0xFFFF4000 - r/o (physical memory overlaps with vectors & intr. stack & FIQ stack)
 *  0xFFFF4900 - Abort stack (2k - 256 bytes)
 *  0xFFFF5000 - disabled for protection
 *  0xFFFF6000 - r/o (physical memory overlaps with vectors & intr. stack)
 *  0xFFFF6800 - FIQ stack (256 bytes)
 *  0xFFFF6900 - r/o (physical memory overlaps with Abort stack)
 *  0xFFFF7000 - disabled
 *  0xFFFFC000 - kernel stack
 *  0xFFFFC800 - KDataStruct
 *  0xFFFFCC00 - disabled for protection (2nd level page table for 0xFFF00000)
 */

typedef struct _PAGETBL {
    ulong   PTEs[256];
} PAGETBL;

typedef struct ARM_HIGH {
    ulong   firstPT[4096];      // 0xFFFD0000: 1st level page table
    PAGETBL aPT[16];            // 0xFFFD4000: 2nd level page tables
    char    reserved2[0x20000-0x4000-16*sizeof(PAGETBL)];

    char    exVectors[0x400];   // 0xFFFF0000: exception vectors
    char    reserved3[0x2400-0x400];

    char    intrStack[0x400];   // 0xFFFF2400: interrupt stack
    char    reserved4[0x4900-0x2800];

    char    abortStack[0x700];  // 0xFFFF4900: abort stack
    char    reserved5[0x6800-0x5000];

    char    fiqStack[0x100];    // 0xFFFF6800: FIQ stack
    char    reserved6[0xC000-0x6900];

    char    kStack[0x800];      // 0xFFFFC000: kernel stack
    struct KDataStruct kdata;   // 0xFFFFC800: kernel data page
} ARM_HIGH;

#define ArmHigh ((ARM_HIGH *)0xFFFD0000)
#define FirstPT (ArmHigh->firstPT)
#define PageTables (ArmHigh->aPT)
#define KData   (ArmHigh->kdata)
#define VKData  (*(volatile struct KDataStruct *)&KData)

//ERRFALSE((ulong)PUserKData==(ulong)&KData);

#define hCurThread  (KData.ahSys[SH_CURTHREAD])
#define hCurProc    (KData.ahSys[SH_CURPROC])
#define pCurThread  (KData.pCurThd)
#define pCurProc    (KData.pCurPrc)
#define ReschedFlag (KData.bResched)
#define PowerOffFlag (KData.bPowerOff)
#define ProfileFlag (KData.bProfileOn)
#define CurAKey     (pCurThread->aky)
#define SectionTable (KData.aSections)
#define MustReschedule()    (*(ushort*)&KData.bResched == 1)
#define IntrEvents  (KData.alpeIntrEvents)
#define IntrData    (KData.alpvIntrData)
#define KPlpvTls    (KData.lpvTls)
#define KInfoTable  (KData.aInfo)
#define DIRECT_RETURN (KData.pAPIReturn)
#define MemoryMap   (KData.pMap)
#define InDebugger  (KData.dwInDebugger)
#define PageTableDescriptor (KData.ptDesc)
#define KCResched   (KData.dwKCRes)
/*
#ifdef InterlockedCompareExchange
#undef InterlockedCompareExchange
#endif

#define InterlockedExchange \
        ((LONG (*)(LPLONG Target, LONG Value))(PUserKData+0x3D4))
#define InterlockedExchangeAdd \
        ((long (*)(long *target, long increment))(PUserKData+0x3C0))
#define InterlockedCompareExchange \
        ((void *(*)(void **target, void *newValue, void *comparand))\
        (PUserKData+0x3AC))
#define InterlockedPushList \
        ((void *(*)(void *pHead, void *pItem))(PUserKData+0x398))
#define InterlockedPopList \
        ((void *(*)(void *pHead))(PUserKData+0x380))

#define InterlockedDecrement(target) (InterlockedExchangeAdd(target, -1L)-1)
#define InterlockedIncrement(target) (InterlockedExchangeAdd(target, 1L)+1)
#define InterlockedTestExchange(Target, oldValue, newValue) \
        ((long)InterlockedCompareExchange((void**)(Target), \
        (void*)(newValue), (void*)(oldValue)))
*/
// End From NkARM.h

// Flags for CacheSync
#define CACHE_SYNC_DISCARD      0x001   // write back & discard all cached data
#define CACHE_SYNC_INSTRUCTIONS 0x002   // discard all cached instructions
#define CACHE_SYNC_WRITEBACK    0x004   // write back but don't discard data cache

/* For RegisterApiSet */
#define REGISTER_APISET_TYPE 0x80000000

typedef struct _CALLBACKINFO {
    HANDLE  hProc;      // destination process
    FARPROC pfn;        // function to call in dest. process
    PVOID   pvArg0;     // arg0 data
} CALLBACKINFO;
typedef CALLBACKINFO *PCALLBACKINFO;

extern "C" {

DWORD       SetProcPermissions    (DWORD);
DWORD       GetCurrentPermissions (void);
BOOL        SetKMode              (BOOL);
BOOL        GetKPhys              (void *ptr, ULONG length);
BOOL        IsBadPtr              (int,const void*,int);
HLOCAL      LocalAllocInProcess   (UINT uFlags, UINT    uBytes, HANDLE  hProc);
HLOCAL      LocalFreeInProcess    (HLOCAL   hMem, HANDLE hProc);
void        CacheSync             (int flags);
BOOL        LockPages             (LPVOID lpvAddress, DWORD cbSize, PDWORD pPFNs, int fOptions);
BOOL        UnlockPages           (LPVOID lpvAddress, DWORD cbSize);

int         QueryAPISetID         (char *pName);
HANDLE      CreateAPISet          (char acName[4], USHORT cFunctions, const PFNVOID *ppfnMethods, const DWORD *pdwSig);
BOOL        RegisterAPISet        (HANDLE hASet, DWORD dwSetID);
DWORD       PerformCallBack4      (PCALLBACKINFO pcbi, ...);

BOOL        SetSystemDefaultLCID  (LCID Locale);
BOOL        RegCopyFile           (LPCWSTR lpszFile);
BOOL        RegRestoreFile        (LPCWSTR lpszFile);

} // extern "C"

#define KINX_PTOC      12   /* ptr to ROM table of contents */
#define g_pTOC KInfoTable[KINX_PTOC]

#define MemoryInfo (*(MEMORYINFO*)KInfoTable[KINX_MEMINFO])

#endif /* _EYRONUTILSOPENSOURCE_H */

⌨️ 快捷键说明

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