Buchempfehlung
MySQL kurz & gut
MySQL kurz & gut
Das preiswerte Taschen- buch stellt MySQL-rele- vante Inhalte systematisch und knapp dar, sodass es sich optimal zum Nach- schlagen beim Pro- grammieren eignet. [Mehr Infos...]
FreeBASIC-Chat
Es sind Benutzer im FreeBASIC-Chat online.
(Stand:  )
FreeBASIC bei Twitter
Twitter FreeBASIC-Nachrichten jetzt auch über Twitter erhalten. Follow us!

fb:porticula NoPaste

Info
Info / Hilfe
Liste
Übersicht / Liste
Neu
Datei hochladen
Suche
Quellcode suchen
Download
Dateidownload

detours.bi modified

Uploader:MitgliedCherry
Datum/Zeit:09.09.2010 18:45:46

'00back from Start.bi to detours.h

'01file: detours.h

' '''''''''''''''''''''''''''''''''''''''
' '
' '  Core Detours Functionality (detours.h of detours.lib)
' '
' '  Microsoft Research Detours Package, Version 2.1.
' '
' '  Copyright (c) Microsoft Corporation.  All rights reserved.
' '

#pragma once
#IFNDEF _DETOURS_H_
#DEFINE _DETOURS_H_
#DEFINE DETOURS_VERSION     20100   ' 2.1.0

' '''''''''''''''''''''''''''''''''''''''
' '

#Define _MSC_VER 1299
#IF (_MSC_VER < 1299)

TYPE LONG_PTR AS LONG
TYPE ULONG_PTR AS ULONG

#ENDIF
#IFNDEF __in_z
#DEFINE __in_z
#ENDIF ' __in_z

' '''''''''''''''''''''''''''''''''''''''
' '

#IFNDEF GUID_DEFINED
#DEFINE GUID_DEFINED

TYPE _GUID
  Data1 AS DWORD
  Data2 AS WORD
  Data3 AS WORD
  Data4(0 TO 8-1) AS BYTE
END Type
Type GUID As _GUID

#IFDEF INITGUID
#DEFINE DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) _

         Dim Name As Const GUID = Type(l, w1, w2, Type( b1, b2,  b3,  b4,  b5,  b6,  b7,  b8))

#ELSE
#DEFINE DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) _

Dim Name As Const GUID

#ENDIF ' INITGUID
#EndIf ' !GUID_DEFINED ' GUID_DEFINED
#IF DEFINED(__cplusplus)
#IFNDEF _REFGUID_DEFINED
#DEFINE _REFGUID_DEFINED
#DEFINE REFGUID             const GUID AND
#ENDIF ' !_REFGUID_DEFINED ' _REFGUID_DEFINED
#ELSE ' 0=__cplusplus
#IFNDEF _REFGUID_DEFINED
#DEFINE _REFGUID_DEFINED
' ??? #DEFINE REFGUID             const GUID * const
#ENDIF ' !_REFGUID_DEFINED ' _REFGUID_DEFINED
#ENDIF ' !__cplusplus

' '
' '''''''''''''''''''''''''''''''''''''''

#IFDEF __cplusplus

' extern "C" {

#ENDIF ' __cplusplus

' '''''''''''''''''''''''''/ Instruction Target Macros.
' '

#DEFINE DETOUR_INSTRUCTION_TARGET_NONE          ((PVOID)0)
#DEFINE DETOUR_INSTRUCTION_TARGET_DYNAMIC       ((PVOID)(LONG_PTR)-1)
#DEFINE DETOUR_SECTION_HEADER_SIGNATURE         &h00727444   ' !"Dtr\0"

Extern DETOUR_EXE_RESTORE_GUID As const GUID

#DEFINE DETOUR_TRAMPOLINE_SIGNATURE             &h21727444  ' Dtr0=

TYPE PDETOUR_TRAMPOLINE AS _DETOUR_TRAMPOLINE PTR

' '''''''''''''''''''''''''''''/ Binary Structures.
' '

TYPE _DETOUR_SECTION_HEADER Field = 8
  cbHeaderSize AS DWORD
  nSignature AS DWORD
  nDataOffset AS DWORD
  cbDataSize AS DWORD
  nOriginalImportVirtualAddress AS DWORD
  nOriginalImportSize AS DWORD
  nOriginalBoundImportVirtualAddress AS DWORD
  nOriginalBoundImportSize AS DWORD
  nOriginalIatVirtualAddress AS DWORD
  nOriginalIatSize AS DWORD
  nOriginalSizeOfImage AS DWORD
  cbPrePE AS DWORD
  nOriginalClrFlags AS DWORD
  reserved1 AS DWORD
  reserved2 AS DWORD
  reserved3 AS DWORD
END TYPE

TYPE _DETOUR_SECTION_RECORD Field = 8
  cbBytes AS DWORD
  nReserved AS DWORD
  guid AS GUID
END TYPE

TYPE _DETOUR_CLR_HEADER Field = 8
  cb AS ULong ' Header versioning
  MajorRuntimeVersion AS USHORT
  MinorRuntimeVersion AS USHORT
  MetaData AS IMAGE_DATA_DIRECTORY ' Symbol table and startup information
  Flags AS ULONG
END TYPE

TYPE _DETOUR_EXE_RESTORE Field = 8
  cb AS ULONG
  pidh AS PIMAGE_DOS_HEADER
  pinh AS PIMAGE_NT_HEADERS
  pclrFlags AS PULONG
  impDirProt AS DWORD
  idh AS IMAGE_DOS_HEADER
  inh AS IMAGE_NT_HEADERS
  clrFlags AS ULONG
END TYPE

'#DEFINE DETOUR_SECTION_HEADER_DECLARE(cbSectionSize) _
' ???-3 typedef BOOL (CALLBACK *PF_DETOUR_BINARY_BYWAY_CALLBACK)(PVOID pContext,
'                                                          PCHAR pszFile,
'                                                          PCHAR *ppszOutFile);

' { \
'       sizeof(DETOUR_SECTION_HEADER),\
'       DETOUR_SECTION_HEADER_SIGNATURE,\
'       sizeof(DETOUR_SECTION_HEADER),\
'       (cbSectionSize),\
'       \
'       0,\
'       0,\
'       0,\
'       0,\
'       \
'       0,\
'       0,\
'       0,\
'       0,\
' }
' ''''''''''''''''''''''''''''''/ Binary Typedefs.
' '

'TYPE CALLBACK *PF_DETOUR_BINARY_BYWAY_CALLBACK AS FUNCTION CDECL(BYVAL AS PVOID, BYVAL AS PCHAR, BYVAL AS PCHAR PTR) AS BOOL
' ???-3 typedef BOOL (CALLBACK *PF_DETOUR_BINARY_FILE_CALLBACK)(PVOID pContext,
'                                                         PCHAR pszOrigFile,
'                                                         PCHAR pszFile,
'                                                         PCHAR *ppszOutFile);
'TYPE CALLBACK *PF_DETOUR_BINARY_FILE_CALLBACK AS FUNCTION CDECL(BYVAL AS PVOID, BYVAL AS PCHAR, BYVAL AS PCHAR, BYVAL AS PCHAR PTR) AS BOOL
' ???-3 typedef BOOL (CALLBACK *PF_DETOUR_BINARY_SYMBOL_CALLBACK)(PVOID pContext,
'                                                           ULONG nOrigOrdinal,
'                                                           ULONG nOrdinal,
'                                                           ULONG *pnOutOrdinal,
'                                                           PCHAR pszOrigSymbol,
'                                                           PCHAR pszSymbol,
'                                                           PCHAR *ppszOutSymbol);
'TYPE CALLBACK *PF_DETOUR_BINARY_SYMBOL_CALLBACK AS FUNCTION CDECL(BYVAL AS PVOID, BYVAL AS ULONG, BYVAL AS ULONG, BYVAL AS ULONG PTR, BYVAL AS PCHAR, BYVAL AS PCHAR, BYVAL AS PCHAR PTR) AS BOOL
' ???-3 typedef BOOL (CALLBACK *PF_DETOUR_BINARY_COMMIT_CALLBACK)(PVOID pContext);
'TYPE CALLBACK *PF_DETOUR_BINARY_COMMIT_CALLBACK AS FUNCTION CDECL(BYVAL AS PVOID) AS BOOL
' ???-3 typedef BOOL (CALLBACK *PF_DETOUR_ENUMERATE_EXPORT_CALLBACK)(PVOID pContext,
'                                                              ULONG nOrdinal,
'                                                              PCHAR pszName,
'                                                              PVOID pCode);
'TYPE CALLBACK *PF_DETOUR_ENUMERATE_EXPORT_CALLBACK AS FUNCTION CDECL(BYVAL AS PVOID, BYVAL AS ULONG, BYVAL AS PCHAR, BYVAL AS PVOID) AS BOOL
'TYPE PDETOUR_BINARY AS VOID PTR
'TYPE PDETOUR_LOADED_BINARY AS VOID PTR

' '''''''''''''''''''''''''''''' Detours 2.1 APIs.
' '
' LONG  DetourTransactionBegin();

DECLARE FUNCTION DetourTransactionAbort () AS LONG
DECLARE FUNCTION DetourTransactionCommit () AS LONG
DECLARE FUNCTION DetourTransactionCommitEx CDECL(BYVAL AS PVOID PTR PTR) AS LONG
DECLARE FUNCTION DetourUpdateThread CDECL(BYVAL AS HANDLE) AS LONG
DECLARE FUNCTION DetourAttach CDECL(BYVAL AS PVOID PTR, BYVAL AS PVOID) AS LONG
DECLARE FUNCTION DetourAttachEx CDECL(BYVAL AS PVOID PTR, BYVAL AS PVOID, BYVAL AS PDETOUR_TRAMPOLINE PTR, BYVAL AS PVOID PTR, BYVAL AS PVOID PTR) AS LONG
DECLARE FUNCTION DetourDetach CDECL(BYVAL AS PVOID PTR, BYVAL AS PVOID) AS LONG
DECLARE sub DetourSetIgnoreTooSmall CDECL(BYVAL AS BOOL)

' ''''''''''''''''''''''''''''''' Code Functions.
' '
' PVOID  DetourFindFunction(PCSTR pszModule, PCSTR pszFunction);

DECLARE FUNCTION DetourCodeFromPointer CDECL(BYVAL AS PVOID, BYVAL AS PVOID PTR) AS PVOID
DECLARE FUNCTION DetourCopyInstruction CDECL(BYVAL AS PVOID, BYVAL AS PVOID, BYVAL AS PVOID PTR) AS PVOID
DECLARE FUNCTION DetourCopyInstructionEx CDECL(BYVAL AS PVOID, BYVAL AS PVOID, BYVAL AS PVOID PTR, BYVAL AS LONG PTR) AS PVOID

' ''''''''''''''''''''''''''/ Loaded Binary Functions.
' '
' HMODULE  DetourEnumerateModules(HMODULE hModuleLast);

DECLARE FUNCTION DetourGetEntryPoint CDECL(BYVAL AS HMODULE) AS PVOID
DECLARE FUNCTION DetourGetModuleSize CDECL(BYVAL AS HMODULE) AS ULONG
DECLARE FUNCTION DetourEnumerateExports CDECL(BYVAL AS HMODULE, BYVAL AS PVOID, BYVAL AS PF_DETOUR_ENUMERATE_EXPORT_CALLBACK) AS BOOL
DECLARE FUNCTION DetourFindPayload CDECL(BYVAL AS HMODULE, BYVAL AS REFGUID, BYVAL AS DWORD PTR) AS PVOID
DECLARE FUNCTION DetourGetSizeOfPayloads CDECL(BYVAL AS HMODULE) AS DWORD

' ''''''''''''''''''''''''/ Persistent Binary Functions.
' '
' PDETOUR_BINARY  DetourBinaryOpen(HANDLE hFile);

DECLARE FUNCTION DetourBinaryEnumeratePayloads CDECL(BYVAL AS PDETOUR_BINARY, BYVAL AS GUID PTR, BYVAL AS DWORD PTR, BYVAL AS DWORD PTR) AS PVOID
DECLARE FUNCTION DetourBinaryFindPayload CDECL(BYVAL AS PDETOUR_BINARY, BYVAL AS REFGUID, BYVAL AS DWORD PTR) AS PVOID
DECLARE FUNCTION DetourBinarySetPayload CDECL(BYVAL AS PDETOUR_BINARY, BYVAL AS REFGUID, BYVAL AS PVOID, BYVAL AS DWORD) AS PVOID
DECLARE FUNCTION DetourBinaryDeletePayload CDECL(BYVAL AS PDETOUR_BINARY, BYVAL AS REFGUID) AS BOOL
DECLARE FUNCTION DetourBinaryPurgePayloads CDECL(BYVAL AS PDETOUR_BINARY) AS BOOL
DECLARE FUNCTION DetourBinaryResetImports CDECL(BYVAL AS PDETOUR_BINARY) AS BOOL
DECLARE FUNCTION DetourBinaryEditImports CDECL(BYVAL AS PDETOUR_BINARY, BYVAL AS PVOID, BYVAL AS PF_DETOUR_BINARY_BYWAY_CALLBACK, BYVAL AS PF_DETOUR_BINARY_FILE_CALLBACK, BYVAL AS PF_DETOUR_BINARY_SYMBOL_CALLBACK, BYVAL AS PF_DETOUR_BINARY_COMMIT_CALLBACK) AS BOOL
DECLARE FUNCTION DetourBinaryWrite CDECL(BYVAL AS PDETOUR_BINARY, BYVAL AS HANDLE) AS BOOL
DECLARE FUNCTION DetourBinaryClose CDECL(BYVAL AS PDETOUR_BINARY) AS BOOL
' ???-3 typedef BOOL ( *PDETOUR_CREATE_PROCESS_ROUTINEA)
'     (LPCSTR lpApplicationName,
'      LPSTR lpCommandLine,
'      LPSECURITY_ATTRIBUTES lpProcessAttributes,
'      LPSECURITY_ATTRIBUTES lpThreadAttributes,
'      BOOL bInheritHandles,
'      DWORD dwCreationFlags,
'      LPVOID lpEnvironment,
'      LPCSTR lpCurrentDirectory,
'      LPSTARTUPINFOA lpStartupInfo,
'      LPPROCESS_INFORMATION lpProcessInformation);

' '''''''''''''''''''''''''/ Create Process & Load Dll.
' '

TYPE  *PDETOUR_CREATE_PROCESS_ROUTINEA AS FUNCTION CDECL(BYVAL AS LPCSTR, BYVAL AS LPSTR, BYVAL AS LPSECURITY_ATTRIBUTES, BYVAL AS LPSECURITY_ATTRIBUTES, BYVAL AS BOOL, BYVAL AS DWORD, BYVAL AS LPVOID, BYVAL AS LPCSTR, BYVAL AS LPSTARTUPINFOA, BYVAL AS LPPROCESS_INFORMATION) AS BOOL
' ???-3 typedef BOOL ( *PDETOUR_CREATE_PROCESS_ROUTINEW)
'     (LPCWSTR lpApplicationName,
'      LPWSTR lpCommandLine,
'      LPSECURITY_ATTRIBUTES lpProcessAttributes,
'      LPSECURITY_ATTRIBUTES lpThreadAttributes,
'      BOOL bInheritHandles,
'      DWORD dwCreationFlags,
'      LPVOID lpEnvironment,
'      LPCWSTR lpCurrentDirectory,
'      LPSTARTUPINFOW lpStartupInfo,
'      LPPROCESS_INFORMATION lpProcessInformation);
TYPE  *PDETOUR_CREATE_PROCESS_ROUTINEW AS FUNCTION CDECL(BYVAL AS LPCWSTR, BYVAL AS LPWSTR, BYVAL AS LPSECURITY_ATTRIBUTES, BYVAL AS LPSECURITY_ATTRIBUTES, BYVAL AS BOOL, BYVAL AS DWORD, BYVAL AS LPVOID, BYVAL AS LPCWSTR, BYVAL AS LPSTARTUPINFOW, BYVAL AS LPPROCESS_INFORMATION) AS BOOL

DECLARE FUNCTION DetourCreateProcessWithDllA CDECL(BYVAL AS LPCSTR, BYVAL AS __in_z LPSTR, BYVAL AS LPSECURITY_ATTRIBUTES, BYVAL AS LPSECURITY_ATTRIBUTES, BYVAL AS BOOL, BYVAL AS DWORD, BYVAL AS LPVOID, BYVAL AS LPCSTR, BYVAL AS LPSTARTUPINFOA, BYVAL AS LPPROCESS_INFORMATION, BYVAL AS LPCSTR, BYVAL AS LPCSTR, BYVAL AS PDETOUR_CREATE_PROCESS_ROUTINEA) AS BOOL
DECLARE FUNCTION DetourCreateProcessWithDllW CDECL(BYVAL AS LPCWSTR, BYVAL AS __in_z LPWSTR, BYVAL AS LPSECURITY_ATTRIBUTES, BYVAL AS LPSECURITY_ATTRIBUTES, BYVAL AS BOOL, BYVAL AS DWORD, BYVAL AS LPVOID, BYVAL AS LPCWSTR, BYVAL AS LPSTARTUPINFOW, BYVAL AS LPPROCESS_INFORMATION, BYVAL AS LPCSTR, BYVAL AS LPCSTR, BYVAL AS PDETOUR_CREATE_PROCESS_ROUTINEW) AS BOOL

#IFDEF UNICODE
#DEFINE DetourCreateProcessWithDll  DetourCreateProcessWithDllW
#DEFINE PDETOUR_CREATE_PROCESS_ROUTINE     PDETOUR_CREATE_PROCESS_ROUTINEW
#ELSE
#DEFINE DetourCreateProcessWithDll  DetourCreateProcessWithDllA
#DEFINE PDETOUR_CREATE_PROCESS_ROUTINE     PDETOUR_CREATE_PROCESS_ROUTINEA
#ENDIF ' !UNICODE

DECLARE FUNCTION DetourCopyPayloadToProcess CDECL(BYVAL AS HANDLE, BYVAL AS REFGUID, BYVAL AS PVOID, BYVAL AS DWORD) AS BOOL
DECLARE FUNCTION DetourRestoreAfterWith () AS BOOL
DECLARE FUNCTION DetourRestoreAfterWithEx CDECL(BYVAL AS PVOID, BYVAL AS DWORD) AS BOOL
DECLARE FUNCTION DetourGetDetouredMarker () AS HMODULE

' '
' '''''''''''''''''''''''''''''''''''''''

#IFDEF __cplusplus

' }

#ENDIF ' __cplusplus

' '''''''''''''''''''''''' Detours Internal Definitions.
' '

#IFDEF __cplusplus
#IFDEF DETOURS_INTERNAL
#IFNDEF __deref_out
#DEFINE __deref_out
#ENDIF ' __deref_out
#IFNDEF __deref
#DEFINE __deref
#ENDIF ' __deref

' '''''''''''''''''''''''''''''''''''''''
' '

#IF (_MSC_VER < 1299)

'02file not found ???: imagehlp.h
'01back from imagehlp.h to detours.h

TYPE IMAGEHLP_MODULE64 AS IMAGEHLP_MODULE
TYPE PIMAGEHLP_MODULE64 AS PIMAGEHLP_MODULE
TYPE SYMBOL_INFO AS IMAGEHLP_SYMBOL
TYPE PSYMBOL_INFO AS PIMAGEHLP_SYMBOL

' static inline
' LONG InterlockedCompareExchange(LONG *ptr, LONG nval, LONG oval)
' {
'     return (LONG)::InterlockedCompareExchange((PVOID*)ptr, (PVOID)nval, (PVOID)oval);
' }

#ELSE

'02file not found ???: dbghelp.h
'01back from dbghelp.h to detours.h
#ENDIF
#IFDEF IMAGEAPI ' DEFINED by DBGHELP.H
' ???-3 typedef LPAPI_VERSION (NTAPI *PF_ImagehlpApiVersionEx)(LPAPI_VERSION AppVersion);

TYPE NTAPI *PF_ImagehlpApiVersionEx AS FUNCTION CDECL(BYVAL AS LPAPI_VERSION) AS LPAPI_VERSION
' ???-3 typedef BOOL (NTAPI *PF_SymInitialize)(IN HANDLE hProcess,
'                                        IN LPCSTR UserSearchPath,
'                                        IN BOOL fInvadeProcess);
TYPE NTAPI *PF_SymInitialize AS FUNCTION CDECL(BYVAL AS IN HANDLE, BYVAL AS IN LPCSTR, BYVAL AS IN BOOL) AS BOOL
' ???-3 typedef DWORD (NTAPI *PF_SymSetOptions)(IN DWORD SymOptions);
TYPE NTAPI *PF_SymSetOptions AS FUNCTION CDECL(BYVAL AS IN DWORD) AS DWORD
' ???-3 typedef DWORD (NTAPI *PF_SymGetOptions)(VOID);
TYPE NTAPI *PF_SymGetOptions AS FUNCTION CDECL(BYVAL AS VOID) AS DWORD
' ???-3 typedef DWORD64 (NTAPI *PF_SymLoadModule64)(IN HANDLE hProcess,
'                                             IN HANDLE hFile,
'                                             IN PSTR ImageName,
'                                             IN PSTR ModuleName,
'                                             IN DWORD64 BaseOfDll,
'                                             IN DWORD SizeOfDll);
TYPE NTAPI *PF_SymLoadModule64 AS FUNCTION CDECL(BYVAL AS IN HANDLE, BYVAL AS IN HANDLE, BYVAL AS IN PSTR, BYVAL AS IN PSTR, BYVAL AS IN DWORD64, BYVAL AS IN DWORD) AS DWORD64
' ???-3 typedef BOOL (NTAPI *PF_SymGetModuleInfo64)(IN HANDLE hProcess,
'                                             IN DWORD64 qwAddr,
'                                             OUT PIMAGEHLP_MODULE64 ModuleInfo);
TYPE NTAPI *PF_SymGetModuleInfo64 AS FUNCTION CDECL(BYVAL AS IN HANDLE, BYVAL AS IN DWORD64, BYVAL AS OUT PIMAGEHLP_MODULE64) AS BOOL
' ???-3 typedef BOOL (NTAPI *PF_SymFromName)(IN HANDLE hProcess,
'                                      IN LPSTR Name,
'                                      OUT PSYMBOL_INFO Symbol);
TYPE NTAPI *PF_SymFromName AS FUNCTION CDECL(BYVAL AS IN HANDLE, BYVAL AS IN LPSTR, BYVAL AS OUT PSYMBOL_INFO) AS BOOL

TYPE _DETOUR_SYM_INFO
  hProcess AS HANDLE
  hDbgHelp AS HMODULE
  pfImagehlpApiVersionEx AS PF_ImagehlpApiVersionEx
  pfSymInitialize AS PF_SymInitialize
  pfSymSetOptions AS PF_SymSetOptions
  pfSymGetOptions AS PF_SymGetOptions
  pfSymLoadModule64 AS PF_SymLoadModule64
  pfSymGetModuleInfo64 AS PF_SymGetModuleInfo64
  pfSymFromName AS PF_SymFromName
END TYPE

DECLARE FUNCTION DetourLoadDbgHelp CDECL(BYVAL AS VOID) AS PDETOUR_SYM_INFO

#ENDIF ' IMAGEAPI
#IFNDEF DETOUR_TRACE
#IF DETOUR_DEBUG
#DEFINE DETOUR_TRACE(x) printf x
#DEFINE DETOUR_BREAK()  DebugBreak()

'02file not found ???: stdio.h
'01back from stdio.h to detours.h

'02file not found ???: limits.h
'01back from limits.h to detours.h
#ELSE
#DEFINE DETOUR_TRACE(x)
#DEFINE DETOUR_BREAK()
#ENDIF
#ENDIF ' DETOUR_TRACE
#IFDEF DETOURS_IA64


' __declspec(align(16)) struct DETOUR_IA64_BUNDLE
' {
'   public:

UNION
  data(0 TO 16-1) AS BYTE
  wide(0 TO 2-1) AS UINT64
END UNION
' struct DETOUR_IA64_METADATA;


'   public:

TYPE DETOUR_IA64_METADATA
END TYPE
' ???-3 typedef BOOL (DETOUR_IA64_BUNDLE::* DETOUR_IA64_METACOPY)
'         (const DETOUR_IA64_METADATA *pMeta, DETOUR_IA64_BUNDLE *pDst) const;

TYPE DETOUR_IA64_BUNDLE::* DETOUR_IA64_METACOPY AS FUNCTION CDECL(BYVAL AS const DETOUR_IA64_METADATA PTR, BYVAL AS DETOUR_IA64_BUNDLE PTR) AS BOOL

ENUM
  A_UNIT  = 1u
  I_UNIT  = 2u
  M_UNIT  = 3u
  B_UNIT  = 4u
  F_UNIT  = 5u
  L_UNIT  = 6u
  X_UNIT  = 7u
  UNIT_MASK = 7u
  STOP    = 8u
END ENUM

TYPE DETOUR_IA64_METADATA
  nTemplate       : 8 AS ULONG
  nUnit0          : 4 AS ' Instruction template. ULONG
  nUnit1          : 4 AS ' Unit for slot 0 ULONG
  nUnit2          : 4 AS ' Unit for slot 1 ULONG
  pfCopy AS ' Unit for slot 2 DETOUR_IA64_METACOPY
END TYPE

DECLARE FUNCTION CopyBytes CDECL(BYVAL AS const DETOUR_IA64_METADATA PTR, BYVAL AS DETOUR_IA64_BUNDLE PTR) AS protected: BOOL
DECLARE FUNCTION CopyBytesMMB CDECL(BYVAL AS const DETOUR_IA64_METADATA PTR, BYVAL AS DETOUR_IA64_BUNDLE PTR) AS BOOL
DECLARE FUNCTION CopyBytesMBB CDECL(BYVAL AS const DETOUR_IA64_METADATA PTR, BYVAL AS DETOUR_IA64_BUNDLE PTR) AS BOOL
DECLARE FUNCTION CopyBytesBBB CDECL(BYVAL AS const DETOUR_IA64_METADATA PTR, BYVAL AS DETOUR_IA64_BUNDLE PTR) AS BOOL
DECLARE FUNCTION CopyBytesMLX CDECL(BYVAL AS const DETOUR_IA64_METADATA PTR, BYVAL AS DETOUR_IA64_BUNDLE PTR) AS BOOL

' static const DETOUR_IA64_METADATA s_rceCopyTable[33];
'
'   public:
'     ' 120 112 104 96 88 80 72 64 56 48 40 32 24 16  8  0
'     '  f.  e.  d. c. b. a. 9. 8. 7. 6. 5. 4. 3. 2. 1. 0.
'
'     '                                      00
'     ' f.e. d.c. b.a. 9.8. 7.6. 5.4. 3.2. 1.0.
'     ' 0000 0000 0000 0000 0000 0000 0000 001f : Template [4..0]
'     ' 0000 0000 0000 0000 0000 03ff ffff ffe0 : Zero [ 41..  5]
'     ' 0000 0000 0000 0000 0000 3c00 0000 0000 : Zero [ 45.. 42]
'     ' 0000 0000 0007 ffff ffff c000 0000 0000 : One  [ 82.. 46]
'     ' 0000 0000 0078 0000 0000 0000 0000 0000 : One  [ 86.. 83]
'     ' 0fff ffff ff80 0000 0000 0000 0000 0000 : Two  [123.. 87]
'     ' f000 0000 0000 0000 0000 0000 0000 0000 : Two  [127..124]
'     BYTE    GetTemplate() const;
'     BYTE    GetInst0() const;
'     BYTE    GetInst1() const;
'     BYTE    GetInst2() const;
'     BYTE    GetUnit0() const;
'     BYTE    GetUnit1() const;
'     BYTE    GetUnit2() const;
'     UINT64  GetData0() const;
'     UINT64  GetData1() const;
'     UINT64  GetData2() const;
'
'   public:
'     BOOL    IsBrl() const;
'     VOID    SetBrl();
'     VOID    SetBrl(UINT64 target);
'     UINT64  GetBrlTarget() const;
'     VOID    SetBrlTarget(UINT64 target);
'     VOID    SetBrlImm(UINT64 imm);
'     UINT64  GetBrlImm() const;
'
'     BOOL    IsMovlGp() const;
'     UINT64  GetMovlGp() const;
'     VOID    SetMovlGp(UINT64 gp);
'
'     VOID    SetInst0(BYTE nInst);
'     VOID    SetInst1(BYTE nInst);
'     VOID    SetInst2(BYTE nInst);
'     VOID    SetData0(UINT64 nData);
'     VOID    SetData1(UINT64 nData);
'     VOID    SetData2(UINT64 nData);
'     BOOL    SetNop0();
'     BOOL    SetNop1();
'     BOOL    SetNop2();
'     BOOL    SetStop();
'
'     BOOL    Copy(DETOUR_IA64_BUNDLE *pDst) const;
' };
' #endif ' DETOURS_IA64
'
' '''''''''''''''''''''''''''''''''''''''
'
' #endif ' DETOURS_INTERNAL
' #endif ' __cplusplus
'
' #endif ' _DETOURS_H_
' '
' ''''''''''''''''''''''''''''''''  End of File.
'

'00file: Ende.bi

'00end: include.bi

'Translated by 'h_2_bi.bas', version 0.0
'Open source from Thomas.Freiherr@gmx.net
'                                            Files done: 1
'                                          Files missed: 4
'imagehlp.h
'dbghelp.h
'stdio.h
'limits.h
'                                          Maximum deep: 1
'                                      Bytes translated: 20337