-
Posts
17 -
Joined
-
Last visited
Viktor1703's Achievements
-
Closed source code
-
Viktor1703 reacted to a post in a topic: GDI+ animated loading screens build 2014-06-20 (32 examples)
-
Another example of #Include <WinAPIEx.au3> #Region Global Variables #Region IMAGE_DOS_HEADER Global Const $tagPE_IMAGE_DOS_HEADER = 'word e_magic;' & _ 'word e_cblp;' & _ 'word e_cp;' & _ 'word e_crlc;' & _ 'word e_cparhdr;' & _ 'word e_minalloc;' & _ 'word e_maxalloc;' & _ 'word e_ss;' & _ 'word e_sp;' & _ 'word e_csum;' & _ 'word e_ip;' & _ 'word e_cs;' & _ 'word e_lfarlc;' & _ 'word e_ovno;' & _ 'word e_res[4];' & _ 'word e_oemid;' & _ 'word e_oeminfo;' & _ 'word e_res2[10];' & _ 'long e_lfanew;' #EndRegion #Region IMAGE_FILE_HEADER Global Const $tagPE_IMAGE_FILE_HEADER = 'word Machine;' & _ 'word NumberOfSections;' & _ 'dword TimeDateStamp;' & _ 'dword PointerToSymbolTable;' & _ 'dword NumberOfSymbols;' & _ 'word SizeOfOptionalHeader;' & _ 'word Characteristics;' #EndRegion #Region IMAGE_OPTIONAL_HEADER If (Not @AutoItX64) Then Global $tagPE_IMAGE_OPTIONAL_HEADER = 'word Magic;' & _ 'byte MajorLinkerVersion;' & _ 'byte MinorLinkerVersion;' & _ 'dword SizeOfCode;' & _ 'dword SizeOfInitializedData;' & _ 'dword SizeOfUninitializedData;' & _ 'dword AddressOfEntryPoint;' & _ 'dword BaseOfCode;' & _ 'dword BaseOfData;' & _ '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;' Else Global $tagPE_IMAGE_OPTIONAL_HEADER = 'word Magic;' & _ 'byte MajorLinkerVersion;' & _ 'byte MinorLinkerVersion;' & _ 'dword SizeOfCode;' & _ 'dword SizeOfInitializedData;' & _ 'dword SizeOfUninitializedData;' & _ 'dword AddressOfEntryPoint;' & _ 'dword BaseOfCode;' & _ 'ptr 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;' & _ 'ptr SizeOfStackReserve;' & _ 'ptr SizeOfStackCommit;' & _ 'ptr SizeOfHeapReserve;' & _ 'ptr SizeOfHeapCommit;' & _ 'dword LoaderFlags;' & _ 'dword NumberOfRvaAndSizes;' EndIf #EndRegion #Region IMAGE_NT_HEADER Global Const $tagPE_IMAGE_NT_HEADER = 'dword Signature;' & $tagPE_IMAGE_FILE_HEADER & $tagPE_IMAGE_OPTIONAL_HEADER #EndRegion #Region IMAGE_SECTION_HEADER Global Const $tagPE_IMAGE_SECTION_HEADER = 'byte Name[8];' & _ 'dword VirtualSize;' & _ 'dword VirtualAddress;' & _ 'dword SizeOfRawData;' & _ 'dword PointerToRawData;' & _ 'dword PointerToRelocations;' & _ 'dword PointerToLinenumbers;' & _ 'word NumberOfRelocations;' & _ 'word NumberOfLinenumbers;' & _ 'dword Characteristics;' #EndRegion #EndRegion ;~ For himself If @Compiled Then $iSizeOfImage = __pe_GetSizeOfImage() Switch @error Case 0 MsgBox(0, '', 'Address overlay: ' & $iSizeOfImage & @CRLF & 'Size of the data in the overlay: ' & (FileGetSize(@ScriptFullPath) - $iSizeOfImage) & ' bytes') Case 1 MsgBox(0, '', 'Unable to get a pointer to the module') Case 2 MsgBox(0, '', 'Failed to retrieve the handle to the specified module') Case 3 MsgBox(0, '', 'File is not executable') Case 4 MsgBox(0, '', 'Invalid signature') EndSwitch EndIf #cs ;~ For third-party file $iSizeOfImage = __pe_GetSizeOfImage('C:\Test.exe') Switch @error Case 0 MsgBox(0, '', 'Address overlay: ' & $iSizeOfImage & @CRLF & 'Size of the data in the overlay: ' & (FileGetSize('C:\Test.exe') - $iSizeOfImage) & ' bytes') Case 1 MsgBox(0, '', 'Unable to get a pointer to the module') Case 2 MsgBox(0, '', 'Failed to retrieve the handle to the specified module') Case 3 MsgBox(0, '', 'File is not executable') Case 4 MsgBox(0, '', 'Invalid signature') EndSwitch #ce Func __pe_GetSizeOfImage($vModuleName = '') Local $hmod, $pImageBase, $tIdh, $iAddr, $tInh, $tIfh, $tIoh, $tIsh If ($vModuleName <> '') Then $hmod = _WinAPI_LoadLibrary($vModuleName) If ((Not $hmod) And @error) Then Return SetError(1, 0, 0) EndIf $pImageBase = _WinAPI_GetModuleHandle($vModuleName) If ((Not $pImageBase) And @error) Then _WinAPI_CloseHandle($hmod) Return SetError(2, 0, 0) EndIf _WinAPI_CloseHandle($hmod) Else $pImageBase = _WinAPI_GetModuleHandle($vModuleName) If ((Not $pImageBase) And @error) Then Return SetError(2, 0, 0) EndIf EndIf $tIdh = DllStructCreate($tagPE_IMAGE_DOS_HEADER, $pImageBase) If (DllStructGetData($tIdh, 'e_magic') <> 0x5A4D) Then Return SetError(3, 0, 0) EndIf $iAddr = ($pImageBase + DllStructGetData($tIdh, 'e_lfanew')) $tInh = DllStructCreate($tagPE_IMAGE_NT_HEADER, $iAddr) If (DllStructGetData($tInh, 'Signature') <> 0x4550) Then Return SetError(4, 0, 0) EndIf $iAddr = (DllStructGetPtr($tIdh) + DllStructGetData($tIdh, 'e_lfanew') + DllStructGetSize(DllStructCreate('long'))) $tIfh = DllStructCreate($tagPE_IMAGE_FILE_HEADER, $iAddr) $iAddr = (DllStructGetPtr($tIfh) + DllStructGetSize(DllStructCreate($tagPE_IMAGE_FILE_HEADER))) $tIoh = DllStructCreate($tagPE_IMAGE_OPTIONAL_HEADER, $iAddr) $iAddr = (DllStructGetPtr($tIoh) + DllStructGetData($tIfh, 'SizeOfOptionalHeader')) $tIsh = DllStructCreate($tagPE_IMAGE_SECTION_HEADER, $iAddr) $iAddr = (DllStructGetPtr($tIsh) + ((DllStructGetData($tIfh, 'NumberOfSections') - 1) * DllStructGetSize(DllStructCreate($tagPE_IMAGE_SECTION_HEADER)))) $tIsh = DllStructCreate($tagPE_IMAGE_SECTION_HEADER, $iAddr) Return (DllStructGetData($tIsh, 'PointerToRawData') + DllStructGetData($tIsh, 'SizeOfRawData')) EndFunc
- 21 replies
-
Thank you very much
-
that is? Does not work
-
Yes, but it is possible to do this ;~ Interface Global Const $IAutoItFunc = 'MsgBox int(uint;wstr;wstr);' & _ 'ToolTip void(wstr;int;int);' ;~ Methods Global $Methods[2] = [DllCallbackRegister('ObjFunc__MsgBox', 'int', 'ptr;uint;wstr;wstr'), _ DllCallbackRegister('ObjFunc__ToolTip', 'none', 'ptr;wstr;int;int')] Func ObjFuncConstructor() Local $tTable, $oObj $tTable = DllStructCreate('ptr VTable;ulong_ptr Number;ptr Method[2]') DllStructSetData($tTable, 'VTable', DllStructGetPtr($tTable, 'Method')) DllStructSetData($tTable, 'Number', 2) DllStructSetData($tTable, 'Method', DllCallbackGetPtr($Methods[0]), 1) DllStructSetData($tTable, 'Method', DllCallbackGetPtr($Methods[1]), 2) $oObj = ObjCreateInterface(DllStructGetPtr($tTable), DllStructGetPtr($tTable), $IAutoItFunc, False) If IsObj($oObj) Then ConsoleWrite(ObjName($oObj) & @CRLF) Return $oObj EndIf Return 0 EndFunc Func ObjFuncDestructor($oObj) Local $i If IsObj($oObj) Then $oObj = Null For $i = 0 To UBound($Methods) - 1 DllCallbackFree($Methods[$i]) Next $Methods = 0 EndIf EndFunc Func ObjFunc__MsgBox($pThis, $iFlag, $sTitle, $sText) Return MsgBox($iFlag, $sTitle, $sText) EndFunc Func ObjFunc__ToolTip($pThis, $sText, $iLeft, $iTop) ToolTip($sText, $iLeft, $iTop) EndFunc $oFunc = ObjFuncConstructor() If IsObj($oFunc) Then $oFunc.MsgBox(32, 'Title', 'Text') ObjFuncDestructor($oFunc) EndIf Exit but often there is an error
-
Viktor1703 reacted to a post in a topic: OnAutoItStartRegister is bug ?
-
OnAutoItStartRegister is bug ?
Viktor1703 replied to Viktor1703's topic in AutoIt General Help and Support
Thanks -
AutioIt v3.3.10.2 Error "$SS_CENTERIMAGE - Variable used without being declared." #OnAutoItStartRegister 'main' #Include <WindowsConstants.au3> #Include <StaticConstants.au3> #Include <GUIConstantsEx.au3> AutoItSetOption('MustDeclareVars', 1) Global $hForm ;main() Func main() $hForm = GUICreate('', 397, 339) GUICtrlCreateLabel('Test', 20, 20, 60, 21, $SS_CENTERIMAGE) GUISetState(@SW_SHOW, $hForm) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch Wend EndFunc Сorrectly #Include <WindowsConstants.au3> #Include <StaticConstants.au3> #Include <GUIConstantsEx.au3> AutoItSetOption('MustDeclareVars', 1) Global $hForm main() Func main() $hForm = GUICreate('', 397, 339) GUICtrlCreateLabel('Test', 20, 20, 60, 21, $SS_CENTERIMAGE) GUISetState(@SW_SHOW, $hForm) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch Wend EndFunc
-
Really doesn't work, I can only advise to write on something another as this option extremely not reliable and will work under control of NET Framework if it isn't present, Dll won't be started For an example Pure С C++ Delphi PureBasic etc. It seems I made, for me works (Windows 8 x64) Code C# using System.IO; public class Test { public static string MyTestForYou(string Value1) { Directory.CreateDirectory("C:\\realygoooooooooooooooood"); return "Test"; } } IL code Dll // Microsoft (R) .NET Framework IL Disassembler. Version 4.0.30319.1 // Metadata version: v2.0.50727 .assembly extern mscorlib { .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4.. .ver 2:0:0:0 } .assembly Test { .custom instance void [mscorlib]System.Reflection.AssemblyTitleAttribute::.ctor(string) = ( 01 00 04 54 65 73 74 00 00 ) // ...Test.. .custom instance void [mscorlib]System.Reflection.AssemblyDescriptionAttribute::.ctor(string) = ( 01 00 00 00 00 ) .custom instance void [mscorlib]System.Reflection.AssemblyConfigurationAttribute::.ctor(string) = ( 01 00 00 00 00 ) .custom instance void [mscorlib]System.Reflection.AssemblyCompanyAttribute::.ctor(string) = ( 01 00 00 00 00 ) .custom instance void [mscorlib]System.Reflection.AssemblyProductAttribute::.ctor(string) = ( 01 00 04 54 65 73 74 00 00 ) // ...Test.. .custom instance void [mscorlib]System.Reflection.AssemblyCopyrightAttribute::.ctor(string) = ( 01 00 12 43 6F 70 79 72 69 67 68 74 20 C2 A9 20 // ...Copyright .. 20 32 30 31 34 00 00 ) // 2014.. .custom instance void [mscorlib]System.Reflection.AssemblyTrademarkAttribute::.ctor(string) = ( 01 00 00 00 00 ) .custom instance void [mscorlib]System.Runtime.InteropServices.ComVisibleAttribute::.ctor(bool) = ( 01 00 00 00 00 ) .custom instance void [mscorlib]System.Runtime.InteropServices.GuidAttribute::.ctor(string) = ( 01 00 24 34 30 62 30 33 35 62 62 2D 32 63 38 30 // ..$40b035bb-2c80 2D 34 30 37 62 2D 38 63 66 36 2D 63 66 38 64 32 // -407b-8cf6-cf8d2 34 37 31 31 65 38 34 00 00 ) // 4711e84.. .custom instance void [mscorlib]System.Reflection.AssemblyFileVersionAttribute::.ctor(string) = ( 01 00 07 31 2E 30 2E 30 2E 30 00 00 ) // ...1.0.0.0.. // --- ‘«Ґ¤гойЁ© бва Ёў Ґ¬л© ваЁЎгв ¤®Ў ў«Ґ ўв®¬ вЁзҐбЄЁ, Ґ б«Ґ¤гҐв ®в¬Ґпвм ЇаҐ®Ўа §®ў ЁҐ ў Є®¬¬Ґв аЁ© ------- // .custom instance void [mscorlib]System.Diagnostics.DebuggableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggableAttribute/DebuggingModes) = ( 01 00 07 01 00 00 00 00 ) .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilationRelaxationsAttribute::.ctor(int32) = ( 01 00 08 00 00 00 00 00 ) .custom instance void [mscorlib]System.Runtime.CompilerServices.RuntimeCompatibilityAttribute::.ctor() = ( 01 00 01 00 54 02 16 57 72 61 70 4E 6F 6E 45 78 // ....T..WrapNonEx 63 65 70 74 69 6F 6E 54 68 72 6F 77 73 01 ) // ceptionThrows. .hash algorithm 0x00008004 .ver 1:0:0:0 } .module Test.dll // MVID: {2DE6A6E5-507A-4D0B-B56F-59E6CDE17752} .imagebase 0x00400000 .file alignment 0x00000200 .stackreserve 0x00100000 .subsystem 0x0003 // WINDOWS_CUI .corflags 0x00000002 // ILONLY // Image base: 0x02830000 .vtfixup [1] int32 fromunmanaged at VT_01 .data VT_01 = int32(0) // =============== CLASS MEMBERS DECLARATION =================== .class public auto ansi beforefieldinit Test extends [mscorlib]System.Object { .method public hidebysig static string MyTestForYou(string Value1) cil managed { // ђ §¬Ґа Є®¤ : 22 (0x16) .vtentry 1 : 1 .export [1] as MyTestForYou .maxstack 1 .locals init ([0] string CS$1$0000) IL_0000: nop IL_0001: ldstr "C:\\realygoooooooooooooooood" IL_0006: call class [mscorlib]System.IO.DirectoryInfo [mscorlib]System.IO.Directory::CreateDirectory(string) IL_000b: pop IL_000c: ldstr "Test" IL_0011: stloc.0 IL_0012: br.s IL_0014 IL_0014: ldloc.0 IL_0015: ret } // end of method Test::MyTestForYou .method public hidebysig specialname rtspecialname instance void .ctor() cil managed { // ђ §¬Ґа Є®¤ : 7 (0x7) .maxstack 8 IL_0000: ldarg.0 IL_0001: call instance void [mscorlib]System.Object::.ctor() IL_0006: ret } // end of method Test::.ctor } // end of class Test // ============================================================= // *********** „€‡Ђ‘‘…ЊЃ‹€ђЋ‚ЂЌ€… ‡Ђ‚…ђ…ЌЋ *********************** // ‚Ќ€ЊЂЌ€…: ᮧ¤ д ©« аҐбгаб®ў Win32 Test.res AutoIt Code #RequireAdmin $sDll = @ScriptDir & "\Test.dll" $sRet = DllCall($sDll, 'str', 'MyTestForYou', 'str', 'teeest') If @error Then MsgBox(16, 'Dll', @error) Else MsgBox(0, 'Result', $sRet[0]) EndIf Try to compile it Imports System.IO Public Class Test Public Shared Function MyTestForYou(ByVal Value1 As String) As String MkDir("C:\realygoooooooooooooooood") Return "Test" End Function End Class
-
You correctly edited an IL code of your Dll?
-
No, I didn't make, but there is a wish for normal support of namespaces, there is no wish to extend with the AutoItObject.dll program, I simply wanted to learn, whether there will be a support of namespaces in future AutoIt versions?!
-
No, i as have access to function bypassing object MsgBox(0, '', MyUDF1_Test(Null))
-
Imports System.IO Public Class Test Public Function MyTestForYou(ByVal Value1 As String) As String MkDir("C:\realygoooooooooooooooood") ' Demand the administrator in AutoIt a script!??? Return "Test" End Function End Class
-
libraries created by means of VB.NET and C# aren't dynamically connected and are used only in NET Framework similar languages, for this purpose it is necessary to edit dll and edit dll
-
No, OOP isn't necessary to me, I would like to use only namespaces (Modules)
-
Thanks