Sign in to follow this  
Followers 0
wolf9228

Struct_IN_Struct

3 posts in this topic

#1 ·  Posted (edited)

Struct_IN_Struct.au3

Func StringStruct_Add($StrSourceStruct,$StrDestStruct, _
$StrSourceStructElement,$DestArrayElement = 1)
Local $result , $len , $ArrayStruct = "" , $StringLeft = "" , $StringRight = "", $len = "" _
, $NewStr = "" , $Text = ""
$StrSourceStruct = StringStripWS($StrSourceStruct, 3)
$StrDestStruct = StringStripWS($StrDestStruct, 3)
$StrSourceStructElement = StringStripWS($StrSourceStructElement, 3)
$StrSourceStructElement = StringReplace(space($StrSourceStructElement),";","")
if StringRight($StrSourceStruct, 1) == ";" Then $StrSourceStruct = _
StringTrimRight($StrSourceStruct,1)
if StringRight($StrDestStruct, 1) == ";" Then $StrDestStruct = _
StringTrimRight($StrDestStruct,1)
if DllStructCreate($StrSourceStruct) == 0 Or _
DllStructCreate($StrDestStruct) == 0 Then Return False
$result = StringInStr($StrSourceStruct,$StrSourceStructElement)
if Not ($result) Then Return False
$result -= 1
$len1 = StringLen($StrSourceStruct)
$len2 = StringLen($StrSourceStructElement)
For $j = 1 To $DestArrayElement
$StringSplit1 = StringSplit($StrDestStruct,";")
For $q = 1 To $StringSplit1[0]
$StringSplit2 = StringSplit(space($StringSplit1[$q])," ")
if $DestArrayElement > 1 Then $Text = "Element" & $j
$NewStr &= $StringSplit2[1] & " " & $StringSplit2[2] & $Text & ";"
Next
$ArrayStruct &= $NewStr
$NewStr = ""
Next
$ArrayStruct = StringTrimRight($ArrayStruct,1)
$StringLeft = StringLeft($StrSourceStruct, $result)
$StringRight = StringRight($StrSourceStruct,($len1 - $len2) - $result)
$NewStrStruct = $StringLeft & $ArrayStruct & $StringRight
if DllStructCreate($NewStrStruct) <> 0 Then Return $NewStrStruct
Return False
EndFunc

Func Str_StructArrayElemen_Create($StrStruct,$ArrayElement)
Local $ArrayStruct = "" , $NewStr = ""
if DllStructCreate($StrStruct) == 0 Then Return False
$StrStruct = StringStripWS($StrStruct, 3)
if StringRight($StrStruct, 1) == ";" Then $StrStruct = _
StringTrimRight($StrStruct,1)
For $j = 1 To $ArrayElement
$StringSplit1 = StringSplit($StrStruct,";")
For $q = 1 To $StringSplit1[0]
$StringSplit2 = StringSplit(space($StringSplit1[$q])," ")
if $ArrayElement > 1 Then $Text = "Element" & $j
$NewStr &= $StringSplit2[1] & " " & $StringSplit2[2] & "Element" & $j & ";"
Next
$ArrayStruct &= $NewStr
$NewStr = ""
Next
$ArrayStruct = StringTrimRight($ArrayStruct,1)
if DllStructCreate($ArrayStruct) == 0 Then Return False
Return $ArrayStruct
EndFunc

Func DllStructGet_DataArray($StrStruct,$Struct)
Local $DataArray[1][2]
if DllStructCreate($StrStruct) == 0 Or Not IsDllStruct($Struct) _
Then Return False
$StrStruct = StringStripWS($StrStruct, 3)
if StringRight($StrStruct, 1) == ";" Then $StrStruct = _
StringTrimRight($StrStruct,1)
$StringSplit1 = StringSplit($StrStruct,";")
For $q = 1 To $StringSplit1[0]
$StringSplit2 = StringSplit(space($StringSplit1[$q])," ")
$DataArray[UBound($DataArray) - 1][0] = $StringSplit2[1] & " " & $StringSplit2[2]
$DataArray[UBound($DataArray) - 1][1] = DllStructGetData($Struct,$StringSplit2[2])
ReDim $DataArray[UBound($DataArray) + 1][2]
Next
ReDim $DataArray[UBound($DataArray) - 1][2]
Return $DataArray
EndFunc

Func space($Text)
Local $OutText = ""
$Text = StringStripWS($Text, 3)
For $i = 1 To StringLen($Text)
$Char = StringRight(StringLeft($Text, $i),1)
if Not StringIsSpace($Char) Then
$OutText  &= $Char
Else
$OutText &= " "
While 1
$i += 1
$Char = StringRight(StringLeft($Text, $i),1)
if Not StringIsSpace($Char) Then
$i -= 1
ExitLoop
EndIf
WEnd
EndIf
Next
Return $OutText
EndFunc

Example1.au3

;===========Microsoft C ++ 6 struct==========================
;                                  typedef struct _Struct4 {
;                                      DWORD   Element1;
;                                      DWORD   Element2;
;                                  } Struct4, *PStruct4;
;
;                                  typedef struct _Struct3 {
;                                      WORD    Element3;
;                                      BYTE    Element4;
;                                      Struct4 Element5[16];
;                                  } Struct3, *PStruct3;
;
;
;                                  typedef struct _Struct2 {
;                                      WORD    Element6;
;                                      WORD    Element7;
;                                      DWORD   Element8;
;                                  } Struct2, *PStruct2;
;
;                                  typedef struct _Struct1 {
;                                      DWORD Element9;
;                                      Struct2 Element10;
;                                      Struct3 Element11;
;                                  } Struct1, *PStruct1;
;===========Microsoft C ++ 6 struct==========================

;=============== Autoit TegStruct ========================
;$TegStruct1 = "DWORD var9;ptr Struct2;ptr Struct3"
;$TegStruct2 = "ushort var6;ushort var7;DWORD var8"
;$TegStruct3 = "ushort var3;BYTE var4;ptr Struct4"
;$TegStruct4 = "DWORD var1;DWORD var2"
;=============== Autoit TegStruct ========================

#Include <WinAPI.au3>
#include <GUIConstantsEx.au3>
#include <Constants.au3>
#Include <Array.au3>
#Include <Struct_IN_Struct.au3>

$TegStruct1 = "DWORD var9;ptr Struct2;ptr Struct3"
$TegStruct2 = "ushort var6;ushort var7;DWORD var8"
$TegStruct3 = "ushort var3;BYTE var4;ptr Struct4"
$TegStruct4 = "DWORD var1;DWORD var2"

$TegStruct4 = Str_StructArrayElemen_Create($TegStruct4,16) ;;Struct4 Element5[16]; 16 ==> Element5[16]
$TegStruct3 = StringStruct_Add($TegStruct3,$TegStruct4,"ptr Struct4") ;Struct4 Element5[16];
$NewTegStruct = StringStruct_Add($TegStruct1,$TegStruct2,"ptr Struct2") ;Struct2 Element10;
$NewTegStruct = StringStruct_Add($NewTegStruct,$TegStruct3,"ptr Struct3") ;Struct3 Element11;
MsgBox(0,"",$NewTegStruct)

Example2.au3

;===========Microsoft C ++ 6 struct==========================
;                                  typedef struct {
;                                      DWORD cbSize;
;                                      DWORD flags;
;                                      HCURSOR hCursor;
;                                      POINT ptScreenPos;
;                                  } CURSORINFO, *PCURSORINFO, *LPCURSORINFO;
;
;
;                                  typedef struct tagPOINT {
;                                    LONG x;
;                                    LONG y;
;                                  }POINT, *PPOINT;

;===========Microsoft C ++ 6 struct==========================

;=============== Autoit TegStruct ========================
;$XtagCURSORINFO = "DWORD cbSize;DWORD flags;HWND hCursor;POINT ptScreenPos;"
;$XtagPOINT = "LONG x;LONG y;"
;=============== Autoit TegStruct ========================

#Include <WinAPI.au3>
#include <GUIConstantsEx.au3>
#include <Constants.au3>
#Include <Array.au3>
#Include <Struct_IN_Struct.au3>

$XtagCURSORINFO = "DWORD cbSize;DWORD flags;HWND hCursor;ptr POINT;"
$XtagPOINT = "LONG x;LONG y;"
$XtagCURSORINFO = StringStruct_Add($XtagCURSORINFO,$XtagPOINT,"ptr POINT")
$CURSORINFO = DllStructCreate($XtagCURSORINFO)
DllStructSetData($CURSORINFO,"cbSize",DllStructGetSize($CURSORINFO))
GetCursorInfo(DllStructGetPtr($CURSORINFO))
$DataArray = DllStructGet_DataArray($XtagCURSORINFO,$CURSORINFO)
_ArrayDisplay($DataArray,"DataArray")

;GetCursorInfo Function
;http://msdn.microsoft.com/en-us/library/ms648389%28VS.85%29.aspx
Func GetCursorInfo($pci)
$BOOL = DllCall("user32.dll","int","GetCursorInfo","ptr",$pci)
if Not @error Then
Return $BOOL[0]
Else
Return False
EndIf
EndFunc

Example3.au3

;===========Microsoft C ++ 6 struct==========================
;
;                                  typedef struct tagRGBQUAD {
;                                    BYTE rgbBlue;
;                                    BYTE rgbGreen;
;                                    BYTE rgbRed;
;                                    BYTE rgbReserved;
;                                  }RGBQUAD;
;
;                                  typedef struct tagBITMAPINFOHEADER {
;                                    DWORD biSize;
;                                    LONG  biWidth;
;                                    LONG  biHeight;
;                                    WORD  biPlanes;
;                                    WORD  biBitCount;
;                                    DWORD biCompression;
;                                    DWORD biSizeImage;
;                                    LONG  biXPelsPerMeter;
;                                    LONG  biYPelsPerMeter;
;                                    DWORD biClrUsed;
;                                    DWORD biClrImportant;
;                                  }BITMAPINFOHEADER, *PBITMAPINFOHEADER;
;
;                                  typedef struct tagBITMAPINFO {
;                                    BITMAPINFOHEADER bmiHeader;
;                                    RGBQUAD          bmiColors[1];
;                                  }BITMAPINFO, *PBITMAPINFO;
;
;===========Microsoft C ++ 6 struct==========================

;=============== Autoit TegStruct ========================
;$tagRGBQUAD "BYTE rgbBlue;BYTE rgbGreen;BYTE rgbRed;BYTE rgbReserved;"
;$tagBITMAPINFOHEADER "DWORD biSize;LONG biWidth;LONG biHeight;USHORT biPlanes;USHORT biBitCount;DWORD biCompression;DWORD biSizeImage;LONG  biXPelsPerMeter;LONG  biYPelsPerMeter;DWORD biClrUsed;DWORD biClrImportant;"
;$tagBITMAPINFO "ptr BITMAPINFOHEADER ;ptr RGBQUAD[1];"
;=============== Autoit TegStruct ========================

#Include <WinAPI.au3>
#include <GUIConstantsEx.au3>
#include <Constants.au3>
#Include <Array.au3>
#Include <ScreenCapture.au3>
#Include <Struct_IN_Struct.au3>
Const $XDIB_RGB_COLORS = 0
$XtagRGBQUAD = "BYTE rgbBlue;BYTE rgbGreen;BYTE rgbRed;BYTE rgbReserved;"
$XtagBITMAPINFOHEADER = "DWORD biSize;LONG biWidth;LONG biHeight;USHORT biPlanes;USHORT biBitCount;DWORD biCompression;DWORD biSizeImage;LONG biXPelsPerMeter;LONG biYPelsPerMeter;DWORD biClrUsed;DWORD biClrImportant;"
$XtagBITMAPINFO = "ptr BITMAPINFOHEADER;ptr RGBQUAD;"

$XtagRGBQUAD = Str_StructArrayElemen_Create($XtagRGBQUAD,1)
$XtagBITMAPINFO = StringStruct_Add($XtagBITMAPINFO,$XtagBITMAPINFOHEADER, _
"ptr BITMAPINFOHEADER")
$XtagBITMAPINFO = StringStruct_Add($XtagBITMAPINFO,$XtagRGBQUAD, _
"ptr RGBQUAD")
$BITMAPINFO = DllStructCreate($XtagBITMAPINFO)
DllStructSetData($BITMAPINFO,"biSize",DllStructGetSize($BITMAPINFO))
_ScreenCapture_Capture(@ScriptDir & "\Bmp.bmp")
$hDC = _WinAPI_CreateCompatibleDC(0)
$hBmp = _WinAPI_LoadImage(0,"Bmp.bmp",$IMAGE_BITMAP,0,0,$LR_LOADFROMFILE)
 _WinAPI_GetDIBits($hDC,$hBmp,0,0,0,DllStructGetPtr($BITMAPINFO),$XDIB_RGB_COLORS)
;http://msdn.microsoft.com/en-us/library/dd144879%28VS.85%29.aspx
;GetDIBits Function

$DataArray = DllStructGet_DataArray($XtagBITMAPINFO,$BITMAPINFO)
_ArrayDisplay($DataArray,"DataArray")

Struct_IN_Struct.zip

Edited by wolf9228

صرح السماء كان هنا

 

Share this post


Link to post
Share on other sites



Another example Exe File image Format READ_IMAGE_NT_HEADERS

;===========Microsoft C ++ 6 struct==========================
;                                  // Directory Entries
;
;                                  #define IMAGE_DIRECTORY_ENTRY_EXPORT          0   // Export Directory
;                                  #define IMAGE_DIRECTORY_ENTRY_IMPORT          1   // Import Directory
;                                  #define IMAGE_DIRECTORY_ENTRY_RESOURCE        2   // Resource Directory
;                                  #define IMAGE_DIRECTORY_ENTRY_EXCEPTION       3   // Exception Directory
;                                  #define IMAGE_DIRECTORY_ENTRY_SECURITY        4   // Security Directory
;                                  #define IMAGE_DIRECTORY_ENTRY_BASERELOC       5   // Base Relocation Table
;                                  #define IMAGE_DIRECTORY_ENTRY_DEBUG           6   // Debug Directory
;                                  //      IMAGE_DIRECTORY_ENTRY_COPYRIGHT       7   // (X86 usage)
;                                  #define IMAGE_DIRECTORY_ENTRY_ARCHITECTURE    7   // Architecture Specific Data
;                                  #define IMAGE_DIRECTORY_ENTRY_GLOBALPTR       8   // RVA of GP
;                                  #define IMAGE_DIRECTORY_ENTRY_TLS             9   // TLS Directory
;                                  #define IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG    10   // Load Configuration Directory
;                                  #define IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT   11   // Bound Import Directory in headers
;                                  #define IMAGE_DIRECTORY_ENTRY_IAT            12   // Import Address Table
;                                  #define IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT   13   // Delay Load Import Descriptors
;                                  #define IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR 14   // COM Runtime descriptor
;
;
;
;
;                                  typedef struct _IMAGE_DATA_DIRECTORY {
;                                      DWORD   VirtualAddress;
;                                      DWORD   Size;
;                                  } IMAGE_DATA_DIRECTORY, *PIMAGE_DATA_DIRECTORY;
;
;
;
;                                  IMAGE_NUMBEROF_DIRECTORY_ENTRIES    16
;
;                                  typedef struct _IMAGE_OPTIONAL_HEADER {
;                                      //
;                                      // Standard fields.
;                                      //
;
;                                      WORD    Magic;
;                                      BYTE    MajorLinkerVersion;
;                                      BYTE    MinorLinkerVersion;
;                                      DWORD   SizeOfCode;
;                                      DWORD   SizeOfInitializedData;
;                                      DWORD   SizeOfUninitializedData;
;                                      DWORD   AddressOfEntryPoint;
;                                      DWORD   BaseOfCode;
;                                      DWORD   BaseOfData;
;
;                                      //
;                                      // NT additional fields.
;                                      //
;
;                                      DWORD   ImageBase;
;                                      DWORD   SectionAlignment;
;                                      DWORD   FileAlignment;
;                                      WORD    MajorOperatingSystemVersion;
;                                      WORD    MinorOperatingSystemVersion;
;                                      WORD    MajorImageVersion;
;                                      WORD    MinorImageVersion;
;                                      WORD    MajorSubsystemVersion;
;                                      WORD    MinorSubsystemVersion;
;                                      DWORD   Win32VersionValue;
;                                      DWORD   SizeOfImage;
;                                      DWORD   SizeOfHeaders;
;                                      DWORD   CheckSum;
;                                      WORD    Subsystem;
;                                      WORD    DllCharacteristics;
;                                      DWORD   SizeOfStackReserve;
;                                      DWORD   SizeOfStackCommit;
;                                      DWORD   SizeOfHeapReserve;
;                                      DWORD   SizeOfHeapCommit;
;                                      DWORD   LoaderFlags;
;                                      DWORD   NumberOfRvaAndSizes;
;                                      IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES];
;                                  } IMAGE_OPTIONAL_HEADER32, *PIMAGE_OPTIONAL_HEADER32;
;
;
;                                  typedef struct _IMAGE_FILE_HEADER {
;                                      WORD    Machine;
;                                      WORD    NumberOfSections;
;                                      DWORD   TimeDateStamp;
;                                      DWORD   PointerToSymbolTable;
;                                      DWORD   NumberOfSymbols;
;                                      WORD    SizeOfOptionalHeader;
;                                      WORD    Characteristics;
;                                  } IMAGE_FILE_HEADER, *PIMAGE_FILE_HEADER;
;
;
;                                  typedef struct _IMAGE_NT_HEADERS {
;                                      DWORD Signature;
;                                      IMAGE_FILE_HEADER FileHeader;
;                                      IMAGE_OPTIONAL_HEADER32 OptionalHeader;
;                                  } IMAGE_NT_HEADERS32, *PIMAGE_NT_HEADERS32;
;===========Microsoft C ++ 6 struct==========================

$TegIMAGE_NT_HEADERS = _
    "DWORD Signature;" & _
    "ptr IMAGE_FILE_HEADER;" & _ ;IMAGE_FILE_HEADER FileHeader;
    "ptr IMAGE_OPTIONAL_HEADER32;" ;IMAGE_OPTIONAL_HEADER32 OptionalHeader;

$TagIMAGE_FILE_HEADER = _
    "ushort    Machine;" & _
    "ushort    NumberOfSections;" & _
    "dword     TimeDateStamp;" & _
    "dword     PointerToSymbolTable;" & _
    "dword     NumberOfSymbols;" & _
    "ushort    SizeOfOptionalHeader;" & _
    "ushort    Characteristics"

$TagIMAGE_OPTIONAL_HEADER32 = _
    "ushort  Magic;" & _
    "ubyte   MajorLinkerVersion;" & _
    "ubyte   MinorLinkerVersion;" & _
    "dword   SizeOfCode;" & _
    "dword   SizeOfInitializedData;" & _
    "dword   SizeOfUninitializedData;" & _
    "dword   AddressOfEntryPoint;" & _
    "dword   BaseOfCode;" & _
    "dword   BaseOfData;" & _
    "dword   ImageBase;" & _
    "dword   SectionAlignment;" & _
    "dword   FileAlignment;" & _
    "ushort  MajorOperatingSystemVersion;" & _
    "ushort  MinorOperatingSystemVersion;" & _
    "ushort  MajorImageVersion;" & _
    "ushort  MinorImageVersion;" & _
    "ushort  MajorSubsystemVersion;" & _
    "ushort  MinorSubsystemVersion;" & _
    "dword   Win32VersionValue;" & _
    "dword   SizeOfImage;" & _
    "dword   SizeOfHeaders;" & _
    "dword   CheckSum;" & _
    "ushort  Subsystem;" & _
    "ushort  DllCharacteristics;" & _
    "dword   SizeOfStackReserve;" & _
    "dword   SizeOfStackCommit;" & _
    "dword   SizeOfHeapReserve;" & _
    "dword   SizeOfHeapCommit;" & _
    "dword   LoaderFlags;" & _
    "dword   NumberOfRvaAndSizes;" & _
    "ptr IMAGE_DATA_DIRECTORY" ;IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES];

$TagIMAGE_DATA_DIRECTORY = _
    "dword   VirtualAddress;" & _
    "dword   Size"

#Include <WinAPI.au3>
#include <GUIConstantsEx.au3>
#include <Constants.au3>
#Include <Array.au3>
#Include <Struct_IN_Struct.au3>

;IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES];
;IMAGE_NUMBEROF_DIRECTORY_ENTRIES ==> 16
$TagIMAGE_DATA_DIRECTORY = Str_StructArrayElemen_Create($TagIMAGE_DATA_DIRECTORY,16)
$TagIMAGE_OPTIONAL_HEADER32 = StringStruct_Add($TagIMAGE_OPTIONAL_HEADER32 _
,$TagIMAGE_DATA_DIRECTORY,"ptr IMAGE_DATA_DIRECTORY")

$TegIMAGE_NT_HEADERS = StringStruct_Add($TegIMAGE_NT_HEADERS,$TagIMAGE_FILE_HEADER, _
"ptr IMAGE_FILE_HEADER")

$TegIMAGE_NT_HEADERS = StringStruct_Add($TegIMAGE_NT_HEADERS,$TagIMAGE_OPTIONAL_HEADER32, _
"ptr IMAGE_OPTIONAL_HEADER32")

READ_IMAGE_NT_HEADERS("AUTOIT.EXE",$TegIMAGE_NT_HEADERS)

Func READ_IMAGE_NT_HEADERS($sFile,$TegIMAGE_NT_HEADERS)
    Local $nBytes , $hFile , $MovePos , $ImageArray[10][2]
    $FileSize =  FileGetSize($sFile)
    $hFile = _WinAPI_CreateFile($sFile, 2, 2)
    If Not ($hFile) Then Return -1
    $ImageArray[0][0] =  $hFile
    $ImageArray[0][1] = "File handle"
    $ImageArray[1][0] =  $FileSize
    $ImageArray[1][1] = "File Size"
    $IMAGE_DOS_HEADER = READ_IMAGE_DOS_HEADER($hFile,0)
    $Size = DllStructGetSize($IMAGE_DOS_HEADER)
    Local $IMAGE_DOS_SIGNATURE_MAC  = 0x4D5A ;C++6 WINNT.H
    Local $IMAGE_DOS_SIGNATURE  = 0x5A4D ;C++6 WINNT.H
    if DllStructGetData($IMAGE_DOS_HEADER,"magic") <> $IMAGE_DOS_SIGNATURE_MAC And _
    DllStructGetData($IMAGE_DOS_HEADER,"magic") <> $IMAGE_DOS_SIGNATURE Then Return -2
    $MovePos = DllStructGetData($IMAGE_DOS_HEADER,"lfanew")
    _WinAPI_SetFilePointer($hFile,$MovePos)
    $IMAGE_NT_HEADERS = DllStructCreate($TegIMAGE_NT_HEADERS)
    $Size = DllStructGetSize($IMAGE_NT_HEADERS)
    $PIMAGE_NT_HEADERS = DllStructGetPtr($IMAGE_NT_HEADERS)
    _WinAPI_ReadFile($hFile,$PIMAGE_NT_HEADERS,$Size,$nBytes)
    $DataArray = DllStructGet_DataArray($TegIMAGE_NT_HEADERS,$IMAGE_NT_HEADERS)
   _ArrayDisplay($DataArray,"DataArray")

EndFunc

Func READ_IMAGE_DOS_HEADER($hFile,$MovePos)
    Local $nBytes
    _WinAPI_SetFilePointer($hFile,$MovePos)
    $IMAGE_DOS_HEADER = CRE_IMAGE_DOS_HEADER()
    $Size = DllStructGetSize($IMAGE_DOS_HEADER)
    $PIMAGE_DOS_HEADER = DllStructGetPtr($IMAGE_DOS_HEADER)
    _WinAPI_ReadFile($hFile,$PIMAGE_DOS_HEADER,$Size,$nBytes)
    Return $IMAGE_DOS_HEADER
EndFunc


Func CRE_IMAGE_DOS_HEADER($BytePtr = 0)
    $Tag =                  _                 ;// DOS .EXE header C++6 WINNT.H
    "ushort   magic;" & _                     ;// Magic number
    "ushort   cblp;" & _                      ;// Bytes on last page of file
    "ushort   cp;" & _                        ;// Pages in file
    "ushort   crlc;" & _                      ;// Relocations
    "ushort   cparhdr;" & _                   ;// Size of header in paragraphs
    "ushort   minalloc;" & _                  ;// Minimum extra paragraphs needed
    "ushort   maxalloc;" & _                  ;// Maximum extra paragraphs needed
    "ushort   ss;" & _                        ;// Initial (relative) SS value
    "ushort   sp;" & _                        ;// Initial SP value
    "ushort   csum;" & _                      ;// Checksum
    "ushort   ip;" & _                        ;// Initial IP value
    "ushort   cs;" & _                        ;// Initial (relative) CS value
    "ushort   lfarlc;" & _                    ;// File address of relocation table
    "ushort   ovno;" & _                      ;// Overlay number
    "ushort   res[4];" & _                    ;// Reserved words
    "ushort   oemid;" & _                     ;// OEM identifier (for e_oeminfo)
    "ushort   oeminfo;" & _                   ;// OEM information; e_oemid specific
    "ushort   res2[10];" & _                  ;// Reserved words
    "dword    lfanew"                         ;// File address of new e
    if ($BytePtr) Then _
    Return MRtlMoveMemory($Tag,$BytePtr,64) ;reading the dos header
    Return DllStructCreate($Tag) ;Create
EndFunc


Func MRtlMoveMemory($Tag_Struct,$Ptr,$MovePos)
    $Struct = DllStructCreate($Tag_Struct)
    $StructPtr = DllStructGetPtr($Struct)
    DllCall("Kernel32.dll","none","RtlMoveMemory","ptr",$StructPtr,"ptr",$Ptr,"dword",$MovePos)
    Return $Struct
EndFunc

صرح السماء كان هنا

 

Share this post


Link to post
Share on other sites

Hello,

Could you elaborate on the use a bit more or have any readmes?

Struct_IN_Struct seems an important script,

I'm not a C programmer but have seen some structures in a older game I collaborate in,

I program a bit novice in AutoIT3 for about a year.

Also I'm using AutoIT3 3.3.0.0 is this compatible?

Finally joined the forum just to post this.

Thanks!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0