Leaderboard
Popular Content
Showing content with the highest reputation on 09/22/2016 in all areas
-
Are my AutoIt exes really infected?
Leendert-Jan reacted to JSThePatriot for a topic
If you have been using AutoIt for any length of time you will know that it is a great, and powerful scripting language. As with all powerful languages there comes a downside. Virus creation by those that are malicious. AutoIt has no virii installed on your system, and if a script you have created has been marked as a virus, (and you're not malicious) then this is a false positive. They found a set of instructions in an AutoIt EXE out there somewhere, took the general signature of the file, and now all AutoIt EXE's are marked (or most of them). This can be due to several reasons. AutoIt is packed with UPX. UPX is an open source software compression packer. It is used with many virii (to make them smaller). Malicious scripter got the AutoIt script engine recognized as a virus. And I am sure there are more ways your executable could be marked, but that covers the basics. Now I am sure you are wanting to know what you can do to get back up and running without being recognized as a virus. You have to send in a report to the offending AV company alerting them to the false positive they have made. It never hurts to send in your source code along with a compiled exe, to help them realize their mistake. You may have to wait up to 24 hours for them to release an update. The time it takes really depends on the offending AV company. Anti-Virus Links AntiVir Website Contact Avast! Website Contact McAfee Website Contact (email address) Symantec (Norton) Website Contact AVG Website Contact (It says sales or other ?'s I assume this will work) ClamWin Website Contact ClamAV Website Contact (I would only contact the ones with "virusdb maintainer or virus submission management") BitDefender Website Contact ZoneLabs Website Contact Norman Website Contact (email address) eSafe Website Contact (login required) A2 (A-Squared) Website Contact (email address) Edit: Added Website links and Contact links. I hope this helps you understand why your AutoIt executables are marked as virii. JS1 point -
Function Reference _AdlibEnhance.au3 Adlib function with support for parameters, pause and resume using Call Back! Sintax: _Adlib_Register( "Function" [, "Params" [, Time [, RepeatCount ]]] ) _Adlib_Pause( "Function" ) _Adlib_Resume( "Function" ) _Adlib_SetTimer( "Function" [, Time ] ) _Adlib_UnRegister( "Function" ) Supports: ; You can call functions with parameters and native functions also! Downloads: Version: 0.10 _AdlibEnhance_(RedirectLink).html Note: Usage example is included! Sample: Fixes: Regards, João Carlos.1 point
-
Hello to all. My name is Daniel, I am original of the Argentina and 9 months ago about that development in Autoit, after having passed through other languages type Basic I found a model of development which adapts to my tastes and I am comfortable, but my performance to generate new applications was slow due to the lack of GUI Builder. I found a model of development which adapts to my tastes and I am comfortable, but my performance to build new applications was slow due to lack of a generator of GUI. This situation led me to find a project open-source which adapted to my needs. Review several of the programs appointed by TheSaint, opting to improve and complete 'GuiBuilder Resurrected' publish by baroquebob; when I did was not (or not view the GUIBuilderNxt update by jaberwacky). Below I dedicate some paragraph to this. Also probe (and I was surprised) with Koda , but they are not open-source. (the ISN Studio is super , but very complex for my) Well, here I leave you the link to download, I do so with the idea that you can use it, give me your opinion and help me improve it. Equally here leave you a list of characteristics, all the changes were designed and implemented in a way that respects the job before made by CyberSlug, Roy, TheSaint and Bob ; without radical changes continuing what they started. * New control 'Pick color' * New properties 'Backgroud Color' and 'Style' * New Functions Export file (.au3) and 'Test' * Other function not finalizated.Yet * Improve Documentation. Wait for your comments... Regards Daniel guibuilder_0.9.3.zip1 point
-
...I'm sure some of you know what will this be about. Have patience and read the whole post and run some code. I find this theme to be very interesting and worth of lost time. Who knows, maybe I will even say something that you didn't know before. It's known that you can't take AutoIt and go with it to the stars. It's not made for that. If you try you will probably die doing it (out of oldness). It's slow. But in the same hand it's strong enough to go there. So, why not mount it on powerful rocket and take a trip here and there. Space is a fun place they say. Here goes... Few days back I found some code in which OpenGL functions were used. Code is written by C.Eugene (brilliant man, I must say). I don't know what language was written in but it looks very interesting. I wasn't able to run the code because I don't know how to. Anyway, since I have some limited experience with OpenGL functions (look here) I was able, after comprehending some aspects of it, to run the code in my head (yeah, I'm a freak). That code when converted to AutoIt looks like this: #NoTrayIcon #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> ; #include "OpenGLconstants.au3"; constants are extracred for this example Opt("GUIOnEventMode", 1) ; Used constants from OpenGLconstants.au3 Global Const $GL_VERSION_1_1 = 1 Global Const $GL_DEPTH_BUFFER_BIT = 0x00000100 Global Const $GL_COLOR_BUFFER_BIT = 0x00004000 Global Const $GL_SRC_COLOR = 0x0300 Global Const $GL_DST_COLOR = 0x0306 Global Const $GL_FOG = 0x0B60 Global Const $GL_FOG_DENSITY = 0x0B62 Global Const $GL_FOG_START = 0x0B63 Global Const $GL_FOG_END = 0x0B64 Global Const $GL_FOG_MODE = 0x0B65 Global Const $GL_FOG_COLOR = 0x0B66 Global Const $GL_BLEND = 0x0BE2 Global Const $GL_FOG_HINT = 0x0C54 Global Const $GL_DONT_CARE = 0x1100 Global Const $GL_MODELVIEW = 0x1700 Global Const $GL_PROJECTION = 0x1701 Global Const $GL_LINEAR = 0x2601 Global Const $PFD_TYPE_RGBA = 0 Global Const $PFD_MAIN_PLANE = 0 Global Const $PFD_DOUBLEBUFFER = 1 Global Const $PFD_DRAW_TO_WINDOW = 4 Global Const $PFD_SUPPORT_OPENGL = 32 Global $iNumStars = 106; number of stars Global $iWidthGUI = 600 Global $iHeightGUI = 400 Global $hGUI = GUICreate("OpenGL Space", $iWidthGUI, $iHeightGUI, -1, -1, $WS_OVERLAPPEDWINDOW) GUISetBkColor(0) Global $hDC, $hRC; device context and rendering context If Not _EnableOpenGL($hGUI, $hDC, $hRC) Then MsgBox(48, "Error", "Error initializing usage of OpenGL functions" & @CRLF & "Error code: " & @error) Exit EndIf _glClear(BitOR($GL_COLOR_BUFFER_BIT, $GL_DEPTH_BUFFER_BIT)); initially cleaning buffers in case something is left there Global $aStar[$iNumStars][3]; x, y, z coordinates Global $aStarColor[$iNumStars][3]; r, g, b color for stars For $i = 0 To $iNumStars - 1 $aStar[$i][0] = Random(-25, 25) $aStar[$i][1] = Random(-25, 25) $aStar[$i][2] = Random(-150, 0) $aStarColor[$i][1] = Random(0.8, 1) $aStarColor[$i][2] = Random(0.8, 1) Next _glClearColor(0, 0, 0, 1); black _glFogi($GL_FOG_MODE, $GL_LINEAR) Global $tFogColor = DllStructCreate("float[4]") DllStructSetData($tFogColor, 1, 1, 4) $pFogColor = DllStructGetPtr($tFogColor) _glFogfv($GL_FOG_COLOR, $pFogColor) _glFogf($GL_FOG_DENSITY, 0.1) _glHint($GL_FOG_HINT, $GL_DONT_CARE) _glFogf($GL_FOG_START, 70) _glFogf($GL_FOG_END, 150) _glEnable($GL_FOG); _glBlendFunc($GL_SRC_COLOR, $GL_DST_COLOR) _glEnable($GL_BLEND) _glLoadIdentity() _glViewport(0, 0, $iWidthGUI, $iHeightGUI) _glMatrixMode($GL_PROJECTION) _glLoadIdentity() $s = $iWidthGUI / $iHeightGUI _glFrustum(-$s * 0.75, $s * 0.75, -0.75, 0.75, 6, 150) _glMatrixMode($GL_MODELVIEW) GUIRegisterMsg(133, "_Preserve"); WM_NCPAINT GUIRegisterMsg(5, "_ResizeGL"); WM_SIZE GUISetOnEvent(-3, "_Quit"); on exit GUISetState(@SW_SHOW, $hGUI) While 1 _GLDraw() Sleep(0) WEnd ; USED FUNCTIONS Func _GLDraw() _glClear(16640); $GL_COLOR_BUFFER_BIT|$GL_DEPTH_BUFFER_BIT; cleaning buffers _glBegin(1); $GL_LINES; gonna draw lines For $i = 0 To $iNumStars - 1 _glColor3f($aStarColor[$i][0], $aStarColor[$i][1], $aStarColor[$i][2]); start color _glVertex3f($aStar[$i][0], $aStar[$i][1], $aStar[$i][2]); start point _glColor3f(0, 0, .2); end color _glVertex3f($aStar[$i][0], $aStar[$i][1], $aStar[$i][2] - 1.5); end point (z is moved) $aStar[$i][2] += 0.3 If $aStar[$i][2] > 5 Then $aStar[$i][0] = Random(-25, 25) $aStar[$i][1] = Random(-25, 25) $aStar[$i][2] = -150 ;$aStarColor[$i][1] = Random(0.8, 1) ;$aStarColor[$i][2] = Random(0.8, 1) EndIf Next _glEnd(); end drawing _SwapBuffers($hDC); "refresh" EndFunc ;==>_GLDraw Func _EnableOpenGL($hWnd, ByRef $hDeviceContext, ByRef $hOpenGLRenderingContext) Local $tPIXELFORMATDESCRIPTOR = DllStructCreate("ushort Size;" & _ "ushort Version;" & _ "dword Flags;" & _ "ubyte PixelType;" & _ "ubyte ColorBits;" & _ "ubyte RedBits;" & _ "ubyte RedShift;" & _ "ubyte GreenBits;" & _ "ubyte GreenShift;" & _ "ubyte BlueBits;" & _ "ubyte BlueShift;" & _ "ubyte AlphaBits;" & _ "ubyte AlphaShift;" & _ "ubyte AccumBits;" & _ "ubyte AccumRedBits;" & _ "ubyte AccumGreenBits;" & _ "ubyte AccumBlueBits;" & _ "ubyte AccumAlphaBits;" & _ "ubyte DepthBits;" & _ "ubyte StencilBits;" & _ "ubyte AuxBuffers;" & _ "ubyte LayerType;" & _ "ubyte Reserved;" & _ "dword LayerMask;" & _ "dword VisibleMask;" & _ "dword DamageMask") DllStructSetData($tPIXELFORMATDESCRIPTOR, "Size", DllStructGetSize($tPIXELFORMATDESCRIPTOR)) DllStructSetData($tPIXELFORMATDESCRIPTOR, "Version", $GL_VERSION_1_1) DllStructSetData($tPIXELFORMATDESCRIPTOR, "Flags", BitOR($PFD_DRAW_TO_WINDOW, $PFD_SUPPORT_OPENGL, $PFD_DOUBLEBUFFER)) DllStructSetData($tPIXELFORMATDESCRIPTOR, "PixelType", $PFD_TYPE_RGBA) DllStructSetData($tPIXELFORMATDESCRIPTOR, "ColorBits", 24) DllStructSetData($tPIXELFORMATDESCRIPTOR, "DepthBits", 32) DllStructSetData($tPIXELFORMATDESCRIPTOR, "LayerType", $PFD_MAIN_PLANE) Local $a_hCall = DllCall("kernel32.dll", "hwnd", "GetModuleHandleW", "wstr", "opengl32.dll") If @error Then Return SetError(1, 0, 0); what??? EndIf If Not $a_hCall[0] Then If DllOpen("opengl32.dll") = -1 Then Return SetError(2, 0, 0); could not open opengl32.dll EndIf EndIf $a_hCall = DllCall("user32.dll", "hwnd", "GetDC", "hwnd", $hWnd) If @error Or Not $a_hCall[0] Then Return SetError(3, 0, 0); could not retrieve a handle to a device context EndIf $hDeviceContext = $a_hCall[0] Local $a_iCall = DllCall("gdi32.dll", "int", "ChoosePixelFormat", "hwnd", $hDeviceContext, "ptr", DllStructGetPtr($tPIXELFORMATDESCRIPTOR)) If @error Or Not $a_iCall[0] Then Return SetError(4, 0, 0); could not match an appropriate pixel format EndIf Local $iFormat = $a_iCall[0] $a_iCall = DllCall("gdi32.dll", "int", "SetPixelFormat", "hwnd", $hDeviceContext, "int", $iFormat, "ptr", DllStructGetPtr($tPIXELFORMATDESCRIPTOR)) If @error Or Not $a_iCall[0] Then Return SetError(5, 0, 0); could not set the pixel format of the specified device context to the specified format EndIf $a_hCall = DllCall("opengl32.dll", "hwnd", "wglCreateContext", "hwnd", $hDeviceContext) If @error Or Not $a_hCall[0] Then Return SetError(6, 0, 0); could not create a rendering context EndIf $hOpenGLRenderingContext = $a_hCall[0] $a_iCall = DllCall("opengl32.dll", "int", "wglMakeCurrent", "hwnd", $hDeviceContext, "hwnd", $hOpenGLRenderingContext) If @error Or Not $a_iCall[0] Then Return SetError(7, 0, 0); failed to make the specified rendering context the calling thread's current rendering context EndIf Return SetError(0, 0, 1); all OK! EndFunc ;==>_EnableOpenGL Func _DisableOpenGL($hWnd, $hDeviceContext, $hOpenGLRenderingContext) ; No point in doing error checking if this is done on exit. Will just call the cleaning functions. DllCall("opengl32.dll", "int", "wglMakeCurrent", "hwnd", 0, "hwnd", 0) DllCall("opengl32.dll", "int", "wglDeleteContext", "hwnd", $hOpenGLRenderingContext) DllCall("user32.dll", "int", "ReleaseDC", "hwnd", $hWnd, "hwnd", $hDeviceContext) EndFunc ;==>_DisableOpenGL Func _ResizeGL($hWnd, $iMsg, $wParam, $lParam) Local $aClientSize[2] = [BitAND($lParam, 65535), BitShift($lParam, 16)] _glLoadIdentity() _glViewport(0, 0, $aClientSize[0], $aClientSize[1]) _glMatrixMode($GL_PROJECTION) _glLoadIdentity() Local $nRatio = $aClientSize[0] / $aClientSize[1] _glFrustum(-$nRatio * .75, $nRatio * .75, -.75, .75, 6.0, 150.0) _glMatrixMode($GL_MODELVIEW) EndFunc ;==>_ResizeGL Func _glBegin($iMode) DllCall("opengl32.dll", "none", "glBegin", "dword", $iMode) EndFunc ;==>_glBegin Func _glBlendFunc($iSfactor, $iDfactor) DllCall("opengl32.dll", "none", "glBlendFunc", "dword", $iSfactor, "dword", $iDfactor) EndFunc ;==>_glBlendFunc Func _glColor3fv($pColorFloat) DllCall("opengl32.dll", "none", "glColor3fv", "ptr", $pColorFloat) EndFunc ;==>_glColor3fv Func _glClear($iMask) DllCall("opengl32.dll", "none", "glClear", "dword", $iMask) EndFunc ;==>_glClear Func _glClearColor($nRed, $nGreen, $nBlue, $nAlpha) DllCall("opengl32.dll", "none", "glClearColor", "float", $nRed, "float", $nGreen, "float", $nBlue, "float", $nAlpha) EndFunc ;==>_glClearColor Func _glColor3f($nRed, $nGreen, $nBlue) DllCall("opengl32.dll", "none", "glColor3f", "float", $nRed, "float", $nGreen, "float", $nBlue) EndFunc ;==>_glColor3f Func _glEnable($iCap) DllCall("opengl32.dll", "none", "glEnable", "dword", $iCap) EndFunc ;==>_glEnable Func _glEnd() DllCall("opengl32.dll", "none", "glEnd") EndFunc ;==>_glEnd Func _glFrustum($nLeft, $nRight, $nBottom, $nTop, $nZNear, $nZFar) DllCall("opengl32.dll", "none", "glFrustum", "double", $nLeft, "double", $nRight, "double", $nBottom, "double", $nTop, "double", $nZNear, "double", $nZFar) EndFunc ;==>_glFrustum Func _glFogf($iName, $nParam) DllCall("opengl32.dll", "none", "glFogf", "dword", $iName, "float", $nParam) EndFunc ;==>_glFogf Func _glFogi($iName, $iParam) DllCall("opengl32.dll", "none", "glFogi", "dword", $iName, "dword", $iParam) EndFunc ;==>_glFogi Func _glFogfv($iName, $pParams) DllCall("opengl32.dll", "none", "glFogfv", "dword", $iName, "ptr", $pParams) EndFunc ;==>_glFogfv Func _glHint($iTarget, $iMode) DllCall("opengl32.dll", "none", "glHint", "dword", $iTarget, "dword", $iMode) EndFunc ;==>_glHint Func _glLoadIdentity() DllCall("opengl32.dll", "none", "glLoadIdentity") EndFunc ;==>_glLoadIdentity Func _glMatrixMode($iMode) DllCall("opengl32.dll", "none", "glMatrixMode", "dword", $iMode) EndFunc ;==>_glMatrixMode Func _glViewport($iX, $iY, $iWidth, $iHeight) DllCall("opengl32.dll", "none", "glViewport", "int", $iX, "int", $iY, "dword", $iWidth, "dword", $iHeight) EndFunc ;==>_glViewport Func _glVertex3f($nX, $nY, $nZ) DllCall("opengl32.dll", "none", "glVertex3f", "float", $nX, "float", $nY, "float", $nZ) EndFunc ;==>glVertex3f Func _glVertex3fv($pPointer) DllCall("opengl32.dll", "none", "glVertex3fv", "ptr", $pPointer) EndFunc ;==>_glVertex3fv Func _SwapBuffers($hDC) DllCall("gdi32.dll", "int", "SwapBuffers", "hwnd", $hDC) EndFunc ;==>_SwapBuffers Func _Preserve() _SwapBuffers($hDC) EndFunc ;==>_Preserve Func _Quit() _DisableOpenGL($hGUI, $hDC, $hRC) Exit EndFunc ;==>_Quit If you would go thru code you would see that I'm saying that the number of stars is 106. Why 106. No particular reason. It's just for one that would run that code to see that something is happening actually. I number of stars is smaller you probably wouldn't spot anything. What can be seen by running it? Well, it's eating up CPU and it's slow like shi*t. But still, it's working!!! That's a good sign. Let's speed it up! How? Will use flying assembly to do that. If you were reading previous threads on this theme than you know that the code to convert must be without built-in functions. If you go thru posted script again, you will see that the problematic part is Random() and arrays. Since OpenGL functions are written to be very wide, there is a possibility to pass a pointer to array (of floats e.g.) to some functions instead of three different float values. For example there is function glColor3f. You feed this function with three float values: _glColor3f(0.8, 0.5, 0.1) Func _glColor3f($nRed, $nGreen, $nBlue) DllCall("opengl32.dll", "none", "glColor3f", "float", $nRed, "float", $nGreen, "float", $nBlue) EndFunc ;==>_glColor3f But, there is also function that does the same but you pass somethig different: Global $tStartColor = DllStructCreate("float[3]") DllStructSetData($tStartColor, 1, 0.8, 1); r DllStructSetData($tStartColor, 1, 0.5, 2); g DllStructSetData($tStartColor, 1, 0.1, 3); b Global $pStartColor = DllStructGetPtr($tStartColor) _glColor3fv($pStartColor) Func _glColor3fv($pColorFloat) DllCall("opengl32.dll", "none", "glColor3fv", "ptr", $pColorFloat) EndFunc ;==>_glColor3fv The effect would be the same. Another problem is to generate random number in some range. How is that done by not using buil-in function? ntdll.dll exports function RtlRandomEx. This function will generate random number (integer) in range 0 to 2147483648. The problem is obviously how to set range. That could be done using mathematics, like this: Global $tRandom = DllStructCreate("dword") Global $pRandom = DllStructGetPtr($tRandom) For $i = 1 To 10 ConsoleWrite($i & ". " & _Random(-23, 121) & @CRLF) Next Func _Random($iMin, $iMax) ;Return Random($iMin, $iMax) DllCall("ntdll.dll", "dword", "RtlRandomEx", "ptr", $pRandom) Return DllStructGetData($tRandom, 1) / (2147483648 - 1) * ($iMax - $iMin) + $iMin EndFunc ;==>_Random If you know the range you can do the calculations before and write something like this (to return integer in range of -25 to 25): Global $tRandom = DllStructCreate("dword") Global $pRandom = DllStructGetPtr($tRandom) For $i = 1 To 10 ConsoleWrite($i & ". " & _Random1() & @CRLF) Next Func _Random1() ;Return Random(-25, 25) DllCall("ntdll.dll", "dword", "RtlRandomEx", "ptr", $pRandom) Return Int(DllStructGetData($tRandom, 1) / 42949672) - 25 ; Return DllStructGetData($tRandom, 1) / 2147483647 * 50 - 25 EndFunc ;==>_Random1 Now that we know that the original script can be written like this: #NoTrayIcon #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> ; #include "OpenGLconstants.au3"; constants are extracred for this examle Opt("GUIOnEventMode", 1) ; Used constants from OpenGLconstants.au3 Global Const $GL_VERSION_1_1 = 1 Global Const $GL_DEPTH_BUFFER_BIT = 0x00000100 Global Const $GL_COLOR_BUFFER_BIT = 0x00004000 Global Const $GL_SRC_COLOR = 0x0300 Global Const $GL_DST_COLOR = 0x0306 Global Const $GL_FOG = 0x0B60 Global Const $GL_FOG_DENSITY = 0x0B62 Global Const $GL_FOG_START = 0x0B63 Global Const $GL_FOG_END = 0x0B64 Global Const $GL_FOG_MODE = 0x0B65 Global Const $GL_FOG_COLOR = 0x0B66 Global Const $GL_BLEND = 0x0BE2 Global Const $GL_FOG_HINT = 0x0C54 Global Const $GL_DONT_CARE = 0x1100 Global Const $GL_MODELVIEW = 0x1700 Global Const $GL_PROJECTION = 0x1701 Global Const $GL_LINEAR = 0x2601 Global Const $PFD_TYPE_RGBA = 0 Global Const $PFD_MAIN_PLANE = 0 Global Const $PFD_DOUBLEBUFFER = 1 Global Const $PFD_DRAW_TO_WINDOW = 4 Global Const $PFD_SUPPORT_OPENGL = 32 Global $iNumStars = 106; number of stars Global $iWidthGUI = 600 Global $iHeightGUI = 400 Global $hGUI = GUICreate("OpenGL Space", $iWidthGUI, $iHeightGUI, -1, -1, $WS_OVERLAPPEDWINDOW) GUISetBkColor(0) Global $tRandom = DllStructCreate("dword") Global $pRandom = DllStructGetPtr($tRandom) Global $hDC, $hRC; device context and rendering context If Not _EnableOpenGL($hGUI, $hDC, $hRC) Then MsgBox(48, "Error", "Error initializing usage of OpenGL functions" & @CRLF & "Error code: " & @error) Exit EndIf _glClear(BitOR($GL_COLOR_BUFFER_BIT, $GL_DEPTH_BUFFER_BIT)); initially cleaning buffers in case something is left there Global $tStars = DllStructCreate("float[" & 3 * $iNumStars & "]") Global $tColors = DllStructCreate("float[" & 3 * $iNumStars & "]") Global $pStars = DllStructGetPtr($tStars) Global $pColors = DllStructGetPtr($tColors) Global $tInt = DllStructCreate("dword") DllStructSetData($tInt, 1, $pStars) Global $pInt = DllStructGetPtr($tInt) Global $tInt1 = DllStructCreate("int") Global $pInt1 = DllStructGetPtr($tInt1) Global $tStartColor = DllStructCreate("float[3]") DllStructSetData($tStartColor, 1, 0.5, 1) DllStructSetData($tStartColor, 1, 0.9, 2) DllStructSetData($tStartColor, 1, 0.9, 3) Global $pStartColor = DllStructGetPtr($tStartColor) Global $tEndColor = DllStructCreate("float[3]") DllStructSetData($tEndColor, 1, 0.2, 3) Global $pEndColor = DllStructGetPtr($tEndColor) $k = TimerInit() For $i = 1 To $iNumStars DllStructSetData($tStars, 1, _Random1(), ($i * 3) - 2) DllStructSetData($tStars, 1, _Random1(), ($i * 3) - 1) DllStructSetData($tStars, 1, _Random3(), $i * 3) DllStructSetData($tColors, 1, _Random2(), ($i * 3) - 1) DllStructSetData($tColors, 1, _Random2(), $i * 3) Next ConsoleWrite(TimerDiff($k) & @CRLF) ;INIT _glClearColor(0, 0, 0, 1) _glFogi($GL_FOG_MODE, $GL_LINEAR); $tFogColor = DllStructCreate("float[4]") DllStructSetData($tFogColor, 1, 1, 4) $pFogColor = DllStructGetPtr($tFogColor) _glFogfv($GL_FOG_COLOR, $pFogColor) _glFogf($GL_FOG_DENSITY, 0.1); _glHint($GL_FOG_HINT, $GL_DONT_CARE); _glFogf($GL_FOG_START, 70); _glFogf($GL_FOG_END, 150); _glEnable($GL_FOG); _glBlendFunc($GL_SRC_COLOR, $GL_DST_COLOR); _glEnable($GL_BLEND) ; End INIT ; ResizeGL _glLoadIdentity(); _glViewport(0, 0, $iWidthGUI, $iHeightGUI); _glMatrixMode($GL_PROJECTION); _glLoadIdentity(); $s = $iWidthGUI / $iHeightGUI _glFrustum(-$s * .75, $s * .75, -.75, .75, 6.0, 150.0) _glMatrixMode($GL_MODELVIEW) ; End ResizeGL GUIRegisterMsg(133, "_Preserve"); WM_NCPAINT GUIRegisterMsg(5, "_ResizeGL"); WM_SIZE GUISetOnEvent(-3, "_Quit"); on exit GUISetState(@SW_SHOW, $hGUI) Global $a = DllStructCreate("float[3]") Global $pa = DllStructGetPtr($a) Global $z While 1 _GLDraw() Sleep(0) WEnd ; FUNCTIONS Func _GLDraw() _glClear(16640); $GL_COLOR_BUFFER_BIT|$GL_DEPTH_BUFFER_BIT; cleaning buffers _glBegin(1); $GL_LINES; gonna draw lines For $i = 1 To $iNumStars $z = DllStructGetData($tStars, 1, $i * 3) DllStructSetData($a, 1, DllStructGetData($tStars, 1, ($i * 3) - 2), 1) DllStructSetData($a, 1, DllStructGetData($tStars, 1, ($i * 3) - 1), 2) DllStructSetData($a, 1, $z, 3) ;_glColor3fv($pColors + ($i - 1) * 12); start color (12 = size of float[3]) _glColor3fv($pStartColor); this is a constant value ;_glVertex3fv($pa); start point _glVertex3fv($pStars + ($i - 1) * 12); start point _glColor3fv($pEndColor); this is a constant value $z -= 1.5; dislocating z coordinate DllStructSetData($a, 1, $z, 3) _glVertex3fv($pa); end point $z += 1.5; returning z coordinate $z += 0.3 DllStructSetData($tStars, 1, $z, $i * 3) If $z > 5 Then DllStructSetData($tStars, 1, _Random1(), ($i * 3) - 2) DllStructSetData($tStars, 1, _Random1(), ($i * 3) - 1) DllStructSetData($tStars, 1, -150, $i * 3) ;DllStructSetData($tColors, 1, _Random2(), ($i * 3) - 1) ;DllStructSetData($tColors, 1, _Random2(), ($i * 3)) EndIf Next _glEnd(); end drawing _SwapBuffers($hDC); "refresh" EndFunc ;==>_GLDraw Func _Random($iMin, $iMax) ;Return Random($iMin, $iMax) DllCall("ntdll.dll", "dword", "RtlRandomEx", "ptr", $pRandom) Return DllStructGetData($tRandom, 1) / 2147483647 * ($iMax - $iMin) + $iMin EndFunc ;==>_Random Func _Random1() ;Return Random(-25, 25) DllCall("ntdll.dll", "dword", "RtlRandomEx", "ptr", $pRandom) Return Int(DllStructGetData($tRandom, 1) / 42949672) - 25 Return DllStructGetData($tRandom, 1) / 2147483647 * 50 - 25 EndFunc ;==>_Random1 Func _Random2() ;Return Random(0.8, 1) DllCall("ntdll.dll", "dword", "RtlRandomEx", "ptr", $pRandom) Return Int((DllStructGetData($tRandom, 1) / 2147483647)) / 5 + 0.8 EndFunc ;==>_Random2 Func _Random3() ;Return Random(-150, 0) DllCall("ntdll.dll", "dword", "RtlRandomEx", "ptr", $pRandom) Return -DllStructGetData($tRandom, 1) / 14316558 EndFunc ;==>_Random3 Func SwapEndian($iValue) Return Hex(BinaryMid($iValue, 1, 4)) EndFunc ;==>SwapEndian Func _EnableOpenGL($hWnd, ByRef $hDeviceContext, ByRef $hOpenGLRenderingContext) Local $tPIXELFORMATDESCRIPTOR = DllStructCreate("ushort Size;" & _ "ushort Version;" & _ "dword Flags;" & _ "ubyte PixelType;" & _ "ubyte ColorBits;" & _ "ubyte RedBits;" & _ "ubyte RedShift;" & _ "ubyte GreenBits;" & _ "ubyte GreenShift;" & _ "ubyte BlueBits;" & _ "ubyte BlueShift;" & _ "ubyte AlphaBits;" & _ "ubyte AlphaShift;" & _ "ubyte AccumBits;" & _ "ubyte AccumRedBits;" & _ "ubyte AccumGreenBits;" & _ "ubyte AccumBlueBits;" & _ "ubyte AccumAlphaBits;" & _ "ubyte DepthBits;" & _ "ubyte StencilBits;" & _ "ubyte AuxBuffers;" & _ "ubyte LayerType;" & _ "ubyte Reserved;" & _ "dword LayerMask;" & _ "dword VisibleMask;" & _ "dword DamageMask") DllStructSetData($tPIXELFORMATDESCRIPTOR, "Size", DllStructGetSize($tPIXELFORMATDESCRIPTOR)) DllStructSetData($tPIXELFORMATDESCRIPTOR, "Version", $GL_VERSION_1_1) DllStructSetData($tPIXELFORMATDESCRIPTOR, "Flags", BitOR($PFD_DRAW_TO_WINDOW, $PFD_SUPPORT_OPENGL, $PFD_DOUBLEBUFFER)) DllStructSetData($tPIXELFORMATDESCRIPTOR, "PixelType", $PFD_TYPE_RGBA) DllStructSetData($tPIXELFORMATDESCRIPTOR, "ColorBits", 24) DllStructSetData($tPIXELFORMATDESCRIPTOR, "DepthBits", 32) DllStructSetData($tPIXELFORMATDESCRIPTOR, "LayerType", $PFD_MAIN_PLANE) Local $a_hCall = DllCall("kernel32.dll", "hwnd", "GetModuleHandleW", "wstr", "opengl32.dll") If @error Then Return SetError(1, 0, 0); what??? EndIf If Not $a_hCall[0] Then If DllOpen("opengl32.dll") = -1 Then Return SetError(2, 0, 0); could not open opengl32.dll EndIf EndIf $a_hCall = DllCall("user32.dll", "hwnd", "GetDC", "hwnd", $hWnd) If @error Or Not $a_hCall[0] Then Return SetError(3, 0, 0); could not retrieve a handle to a device context EndIf $hDeviceContext = $a_hCall[0] Local $a_iCall = DllCall("gdi32.dll", "int", "ChoosePixelFormat", "hwnd", $hDeviceContext, "ptr", DllStructGetPtr($tPIXELFORMATDESCRIPTOR)) If @error Or Not $a_iCall[0] Then Return SetError(4, 0, 0); could not match an appropriate pixel format EndIf Local $iFormat = $a_iCall[0] $a_iCall = DllCall("gdi32.dll", "int", "SetPixelFormat", "hwnd", $hDeviceContext, "int", $iFormat, "ptr", DllStructGetPtr($tPIXELFORMATDESCRIPTOR)) If @error Or Not $a_iCall[0] Then Return SetError(5, 0, 0); could not set the pixel format of the specified device context to the specified format EndIf $a_hCall = DllCall("opengl32.dll", "hwnd", "wglCreateContext", "hwnd", $hDeviceContext) If @error Or Not $a_hCall[0] Then Return SetError(6, 0, 0); could not create a rendering context EndIf $hOpenGLRenderingContext = $a_hCall[0] $a_iCall = DllCall("opengl32.dll", "int", "wglMakeCurrent", "hwnd", $hDeviceContext, "hwnd", $hOpenGLRenderingContext) If @error Or Not $a_iCall[0] Then Return SetError(7, 0, 0); failed to make the specified rendering context the calling thread's current rendering context EndIf Return SetError(0, 0, 1); all OK! EndFunc ;==>_EnableOpenGL Func _DisableOpenGL($hWnd, $hDeviceContext, $hOpenGLRenderingContext) ; No point in doing error checking if this is done on exit. Will just call the cleaning functions. DllCall("opengl32.dll", "int", "wglMakeCurrent", "hwnd", 0, "hwnd", 0) DllCall("opengl32.dll", "int", "wglDeleteContext", "hwnd", $hOpenGLRenderingContext) DllCall("user32.dll", "int", "ReleaseDC", "hwnd", $hWnd, "hwnd", $hDeviceContext) EndFunc ;==>_DisableOpenGL Func _ResizeGL($hWnd, $iMsg, $wParam, $lParam) Local $aClientSize[2] = [BitAND($lParam, 65535), BitShift($lParam, 16)] _glLoadIdentity() _glViewport(0, 0, $aClientSize[0], $aClientSize[1]) _glMatrixMode($GL_PROJECTION) _glLoadIdentity() Local $nRatio = $aClientSize[0] / $aClientSize[1] _glFrustum(-$nRatio * .75, $nRatio * .75, -.75, .75, 6.0, 150.0) _glMatrixMode($GL_MODELVIEW) EndFunc ;==>_ResizeGL Func _glBegin($iMode) DllCall("opengl32.dll", "none", "glBegin", "dword", $iMode) EndFunc ;==>_glBegin Func _glBlendFunc($iSfactor, $iDfactor) DllCall("opengl32.dll", "none", "glBlendFunc", "dword", $iSfactor, "dword", $iDfactor) EndFunc ;==>_glBlendFunc Func _glColor3fv($pColorFloat) DllCall("opengl32.dll", "none", "glColor3fv", "ptr", $pColorFloat) EndFunc ;==>_glColor3fv Func _glClear($iMask) DllCall("opengl32.dll", "none", "glClear", "dword", $iMask) EndFunc ;==>_glClear Func _glClearColor($nRed, $nGreen, $nBlue, $nAlpha) DllCall("opengl32.dll", "none", "glClearColor", "float", $nRed, "float", $nGreen, "float", $nBlue, "float", $nAlpha) EndFunc ;==>_glClearColor Func _glColor3f($nRed, $nGreen, $nBlue) DllCall("opengl32.dll", "none", "glColor3f", "float", $nRed, "float", $nGreen, "float", $nBlue) EndFunc ;==>_glColor3f Func _glEnable($iCap) DllCall("opengl32.dll", "none", "glEnable", "dword", $iCap) EndFunc ;==>_glEnable Func _glEnd() DllCall("opengl32.dll", "none", "glEnd") EndFunc ;==>_glEnd Func _glFrustum($nLeft, $nRight, $nBottom, $nTop, $nZNear, $nZFar) DllCall("opengl32.dll", "none", "glFrustum", "double", $nLeft, "double", $nRight, "double", $nBottom, "double", $nTop, "double", $nZNear, "double", $nZFar) EndFunc ;==>_glFrustum Func _glFogf($iName, $nParam) DllCall("opengl32.dll", "none", "glFogf", "dword", $iName, "float", $nParam) EndFunc ;==>_glFogf Func _glFogi($iName, $iParam) DllCall("opengl32.dll", "none", "glFogi", "dword", $iName, "dword", $iParam) EndFunc ;==>_glFogi Func _glFogfv($iName, $pParams) DllCall("opengl32.dll", "none", "glFogfv", "dword", $iName, "ptr", $pParams) EndFunc ;==>_glFogfv Func _glHint($iTarget, $iMode) DllCall("opengl32.dll", "none", "glHint", "dword", $iTarget, "dword", $iMode) EndFunc ;==>_glHint Func _glLoadIdentity() DllCall("opengl32.dll", "none", "glLoadIdentity") EndFunc ;==>_glLoadIdentity Func _glMatrixMode($iMode) DllCall("opengl32.dll", "none", "glMatrixMode", "dword", $iMode) EndFunc ;==>_glMatrixMode Func _glViewport($iX, $iY, $iWidth, $iHeight) DllCall("opengl32.dll", "none", "glViewport", "int", $iX, "int", $iY, "dword", $iWidth, "dword", $iHeight) EndFunc ;==>_glViewport Func _glVertex3f($nX, $nY, $nZ) DllCall("opengl32.dll", "none", "glVertex3f", "float", $nX, "float", $nY, "float", $nZ) EndFunc ;==>glVertex3f Func _glVertex3fv($pPointer) DllCall("opengl32.dll", "none", "glVertex3fv", "ptr", $pPointer) EndFunc ;==>_glVertex3fv Func _SwapBuffers($hDC) DllCall("gdi32.dll", "int", "SwapBuffers", "hwnd", $hDC) EndFunc ;==>_SwapBuffers Func _Preserve() _SwapBuffers($hDC) EndFunc ;==>_Preserve Func _Quit() _DisableOpenGL($hGUI, $hDC, $hRC) Exit EndFunc ;==>_Quit Ok, that's almost half of the job. All that needs to be done now is to convert the slow part to assembly. There are some things that should be said before though. New (assembly) code will be executed using function CallWindowProc. Some other functions could be used too but there is always a thread issue. You can't be sure if there would be a new thread created. Why is this important? Because if you look at documentation of wglMakeCurrent function, you will see that it works for threads (not processes!). If you make a new thread and want to draw to some rendering context you need to call wglMakeCurrent from that thread to make the association. Interesting thing is that in XP you could even skip that, but on Vista skipping association leads to crash. That's why you will see calls to wglMakeCurrent in script that follows in places you didn't in the previous scripts. Since the script is somewhere larger and this post is large enough I have to attach it. Space.au3 Change the speed using mouse wheel or up an down arrows on your keyboard. Every line of code is commented (hell, even the comments are commented). That script is dealing with 7777 stars (again no particular reason why) and is very, very low on CPU. If you are interested you can learn about floats and dealing with them on processor level by examining that script (that's new) and many, many other stuff. I think I could write a short book on that code It's almost a perfect screensaver. If anyone have any question, ask. You know how they say: "Space: the final frontier..."1 point
-
1 point
-
No worries. If you are interested see my last code post (15). ( Delete (unnecessary) empty CR and run Tidy ) I understand most people dont clean up until there close to finishing up. Just me being fastidious (anal) Good luck with your project ! Bill1 point
-
No, no no...please! That was not at all my intention! I'm very sorry if that's the way I came off! In fact, my intention was to maybe help you. Although, it's getting very late here and I must be off to bed, I'll be in touch tomorrow evening. I hope you don't mind. (Maybe we should move this to PM as we're way off topic anyway now?) You have my full apologies in any case! Have a good evening! bloopie1 point
-
I'll keep it in my toolkit for now. Unfortunately, I still meet people that use Windows XP. Makes me scream. I explain to them how vulnerable they are. I show them the AT admin trick. (if you don't know, on Windows XP machines, you can run At.exe in command line to schedule a system level command prompt. This works even as a guest or limited user.)1 point
-
For this example without the bg image: #cs Display a message one character at a time with the goal of adding a PNG graphic overlay #ce ;~ #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 #include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <GUIConstants.au3> Global $sMessage Global $iString = 0 Global $aInfo HotKeySet("{Esc}","Close") ; in my actual script I read in a file containing all the text to be displayed Global $sText = _ "Lorem ipsum dolor sit amet, consectetur" & @CRLF & _ "elit, sed do eiusmod tempor incididunt ut" & @CRLF & _ @CRLF & _ "Et dolore magna aliqua. Ut enim ad minim," & @CRLF & _ "quis nostrud exercitation ullamco laboris nisi" & @CRLF & _ "aliquip ex ea commodo consequat." & @CRLF & _ @CRLF & _ "Duis aute irure dolor in reprehenderit in" & @CRLF & _ "voluptate velit esse cillum dolore eu fugiat" & @CRLF & _ "nulla pariatur." & @CRLF ;MsgBox (1,"test", $sText) ; Create GUI Global $hGUI = GUICreate("", 450, 340, -1, -1, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST)) ; UEZ's example uses the following instead: ; Global $hGUI = GUICreate("Parent", $iW, $iH, -1, -1, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST) GUISetBkColor(0xFF000000) ; will change background color, which UEZ doesn't use in his example, but then he doesn't want a BG GUISetState(@SW_SHOW) ; Draw a string _GDIPlus_Startup() Global $hBrush = _GDIPlus_BrushCreateSolid(0xFFA05033) Global $hFormat = _GDIPlus_StringFormatCreate() Global $hFamily = _GDIPlus_FontFamilyCreate("ARIAL") Global $hFont = _GDIPlus_FontCreate($hFamily, 14, 0) Global $tLayout = _GDIPlus_RectFCreate(20, 20, 0, 0) Global $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI) Global $hBitmap = _GDIPlus_BitmapCreateFromScan0(420, 300) ; UEZ used ..CreateFromScan0 (?) Global $hBuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap) ; UEZ's Example used the following commands that are not in my script, and I cannot figure out which ones are ; applicable to my goal vs the goal of his example, which was to display a live digital clock ; _GDIPlus_StringFormatSetAlign($hFormat, 0) ; Global $hImage = _GDIPlus_BitmapCreateFromScan0($iW, $iH) ; must achieve something other than CreateFromHWND _GDIPlus_GraphicsSetTextRenderingHint($hBuffer, 4) _GDIPlus_GraphicsSetSmoothingMode($hBuffer, 4) For $iString = 1 to StringLen($sText) $sMessage = StringLeft($sText,$iString) $aInfo = _GDIPlus_GraphicsMeasureString($hGraphic, $sMessage, $hFont, $tLayout, $hFormat) _GDIPlus_GraphicsClear($hBuffer, 0x000000) _GDIPlus_GraphicsDrawStringEx($hBuffer, $sMessage, $hFont, $aInfo[0], $hFormat, $hBrush) $hHBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap) _WinAPI_BitmapDisplayTransparentInGUI($hHBitmap, $hGUI) _WinAPI_DeleteObject($hHBitmap) Next Do Until GUIGetMsg() = $GUI_EVENT_CLOSE Close() ; Clean up resources (my best guess at what needs closing/shutting down) Func Close() _GDIPlus_FontDispose($hFont) _GDIPlus_FontFamilyDispose($hFamily) _GDIPlus_StringFormatDispose($hFormat) _GDIPlus_BrushDispose($hBrush) _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_ImageDispose($hBitmap) _GDIPlus_Shutdown() Exit EndFunc ;==>Close Func _WinAPI_BitmapDisplayTransparentInGUI(ByRef $hHBitmap, ByRef $hGUI, $iOpacity = 0xFF, $bReleaseGDI = True) If Not BitAND(GUIGetStyle($hGUI)[1], $WS_EX_LAYERED) = $WS_EX_LAYERED Then Return SetError(1, 0, 0) Local $tDim = DllStructCreate($tagBITMAP) If Not _WinAPI_GetObject($hHBitmap, DllStructGetSize($tDim), DllStructGetPtr($tDim)) Then Return SetError(2, 0, 0) Local $tSize = DllStructCreate($tagSIZE), $tSource = DllStructCreate($tagPOINT), $tBlend = DllStructCreate($tagBLENDFUNCTION) Local Const $hScrDC = _WinAPI_GetDC(0), $hMemDC = _WinAPI_CreateCompatibleDC($hScrDC), $hOld = _WinAPI_SelectObject($hMemDC, $hHBitmap) $tSize.X = $tDim.bmWidth $tSize.Y = $tDim.bmHeight $tBlend.Alpha = $iOpacity $tBlend.Format = 1 _WinAPI_UpdateLayeredWindow($hGUI, $hScrDC, 0, DllStructGetPtr($tSize), $hMemDC, DllStructGetPtr($tSource), 0, DllStructGetPtr($tBlend), $ULW_ALPHA) _WinAPI_ReleaseDC(0, $hScrDC) _WinAPI_SelectObject($hMemDC, $hOld) _WinAPI_DeleteDC($hMemDC) If $bReleaseGDI Then _WinAPI_DeleteObject($hHBitmap) Return True EndFunc1 point
-
I see what you mean... Try This:1 point
-
@Terenz Now with the change to the UDF above mentioned above. Here is an example that I think will do what you need. #RequireAdmin #include 'Permissions.au3' _InitiatePermissionResources() Global $sFile = @ScriptDir & '\test.txt' FileWrite($sFile, 'test') MsgBox(0, "File", "Created") Global $aPerm[1][3] $aPerm[0][0] = @UserName $aPerm[0][1] = 1 $aPerm[0][2] = $GENERIC_ALL Global $pDACL = _GetObjectDacl($sFile) Global $iRet = _EditObjectPermissions($sFile, $aPerm) MsgBox(0, '', '_EditObjectPermissions return value: ' & $iRet & @CRLF & _ 'Check the file permissons before closing the message box.') $iRet = _SetObjectSecurity($sFile, $SE_FILE_OBJECT, $DACL_SECURITY_INFORMATION, 0, 0, $pDACL, 0) MsgBox(0, '', 'Restore all permissions' & @CRLF & @CRLF & _ '_SetObjectSecurity return value: ' & $iRet & @CRLF & _ 'Check the file permissons before closing the message box.') FileDelete($sFile) MsgBox(0, "File", "Deleted") _ClosePermissionResources() Adam1 point
-
This is the result of hours of debugging and screaming, it's a torrent maker! I have no idea how interesting this is to you guys, but for me it's more of a proof of concept or a personal challange, and since I spend so d*mn much tme on this script I just had to share it It can only create single files torrents but if there is interest I will implement multiple files - Done! http://monoceres.se/Uploads/aTm.zip Torrent download: http://monoceres.se/Uploads/aTm.torrent1 point
-
I am working on updating the old DiskPartitioner code to work in Windows 7 and hopefully Windows 8. Original source is here: At one point a version that supposedly worked with Windows 7 was released on a different forum, but the download has since disappeared. More options will also be added. I really want to make it be able to do absolutely everything that can be done from the command line. Any feedback and/or requests are welcome. ---------------------------------------------------------------- Upcoming changes in next release ---------------------------------------------------------------- ??? ---------------------------------------------------------------- Change Log (also included with the source) ---------------------------------------------------------------- Version 0.4 - released Mar 11, 2013 Bug Fixes: 1. Fixed the partition max size field in the create partition window. Should be good up to at least a petabyte. Was cutting off part of the text before. 2. Buttons on Create Partition Form work after changing size with up/down control / text input. 3. Create Partition - slider now fixed - should work for partitions up to almost 2 petabytes in size ((2^31) - 1 megabytes) 4. Create Partition - up/down now fixed - should work for partitions up to almost 2 petabytes in size 5. Fixed drive information display in both the main window and in the create partition window. 6. Drive capacity calculation. Was using 1000MB as 1GB before. Now correctly using 1024MB as 1GB. 7. Main window - fixed the width of the first column in the partition list. 8. Disks now show up in XP Interface: 1. Create Partition - Slider now has a tooltip so you can see what value the slider has while moving it. 2. Change Disk - window now wider in order to eliminate having to scroll to the right to see all the list fields. 3. Create Partition - When using the up/down control, the pie chart only updates once you release the control. The flickering was very annoying, so it has been changed. ---------------------------------------------------------------------- Version 0.3 Bug Fixes: 1. Can now choose size of extended partition 2. Can now create a primary partition if an extended partition already exists 3. Can now assign drive letters when creating a partition 4. Can now assign drive letters when editing a partition Features: 1. Added more info to main screen. 2. Added the ability when creating or editing a partition to let it assign the first available drive letter Interface: 1. Changed top of main screen layout. 2. Placeholder in add partition screen for setting an offset. Other: 1. Moved more repeated code into functions. ---------------------------------------------------------------------- Version 0.2 1. Removed old debug code, including a popup I forgot to comment out. 2. Made functions out of some repeated code. ---------------------------------------------------------------------- Version 0.1 1. Changed code to work with AutoIT v3 2. Works in Windows 7 ---------------------------------------------------------------- Known Bugs: Creating Partitions: 1. When creating logical partitions, it does not limit it to available size on the extended partition. 3. Will let you try to make more primary partitions if the maximum number is already on the disk. Comes back with success instead of failed even though no partition was actually made. (Feb. 4, 2013) Other: 1. "Check..." button does not work 2. "Defragment.." button does not work ---------------------------------------------------------------- Current source and executable: diskpartitioner_0.4.zip (source) DiskPartitioner_0.4_exe.zip (executable)1 point
-
Microsoft diskpart automation
AshishNamdev reacted to dem3tre for a topic
Microsoft Diskpart Automation API * UPDATED: 9 January 2007 ** Version 0.21 * Added _DiskpartDetailVolume, _DiskpartDetailPartition, and updated the demo to show their use The structure of the API is fairly stable now and should change little going forward as new functions are added. The following functions are currently available: Process commands: _DiskpartStartConsole......Begin an interactive diskpart session _DiskpartCloseConsole......Terminate an interactive diskpart session _DiskpartTerminationCode...Returns the last recorded diskpart process termination codeFocus commands: _DiskpartSelectDisk.........Sets focus to the given disk _DiskpartSelectVolume.......Sets focus to the given volume _DiskpartSelectPartition....Sets focus to the given partition _DiskpartCurrentDisk........Returns the current in-focus disk _DiskpartCurrentVolume......Returns the current in-focus volume _DiskpartCurrentPartition...Returns the current in-focus partitionInformation commands: _DiskpartListDisks................Lists all fixed disks recognized by diskpart _DiskpartListVolumes..............Lists all volumes (including cd/dvd-rom and removeable) _DiskpartListPartitions...........Lists all partitions for the in-focus disk or volume _DiskpartListPartitionsByDisk.....Sets focus to the given disk and lists its partitions _DiskpartListPartitionsByVolume...Sets focus to the given volume and lists its partitions _DiskpartDetailDisk...............Obtains detailed information for the in-focus disk _DiskpartDetailVolume.............Obtains detailed information for the in-focus volume _DiskpartDetailPartition..........Obtains detailed information for the in-focus partitionManagement commands: TODOHelpful functions: TODO _DiskpartFindDiskByDiskID.........Returns the index of the disk with matching Disk ID (ie., 1CCE2CD3) TODO _DiskpartFindDisksByName..........Returns an array of disks that match the given name (ie., Maxtor OneTouch IIIs USB Device) TODO _DiskpartFindDisksByType..........Returns an array of disks of the given type (ie., USB, IDE)Please see the attached dpdemo.au3 file for an example on how to use this. I've done my best to document the code and make things easy to understand. The dpdemo-output.txt is the console output from the sample as run on my test box.win32.au3 diskpart.au3 dpdemo.au3 dpdemo_output.txt1 point -
Look for ; <<<<< to see the differences from the last post. #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 #include <GUIConstantsEx.au3> Global $hParentGUI _Main() Func _Main() Local $iButton_1 $hParentGUI = GUICreate("Example by guinness", 200, 200, -1, -1) $iButton_1 = GUICtrlCreateButton("Show MsgBox()", 10, 10, 85, 25) GUISetState(@SW_SHOW, $hParentGUI) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $iButton_1 GUISetState(@SW_DISABLE, $hParentGUI) _ChildGUI() GUISetState(@SW_ENABLE, $hParentGUI) WinActivate($hParentGUI) ; <<<<< Activate the ParentGUI again. EndSwitch WEnd EndFunc ;==>Main Func _ChildGUI() GUICreate("Custom MsgBox()", 200, 200, -1, -1, -1, -1, $hParentGUI) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE GUIDelete() ExitLoop EndSwitch WEnd EndFunc ;==>_ChildGUI1 point
-
code from WinAPIEx.au3 example folder works in WinPE 2.0 #Include <WinAPIEx.au3> Opt('MustDeclareVars', 1) Global $tDISK_GEOMETRY_EX, $Drive = 0 While 1 $tDISK_GEOMETRY_EX = _WinAPI_GetDriveGeometryEx($Drive) If @error Then ExitLoop EndIf If Not $Drive Then ConsoleWrite('-------------------------------' & @CR) EndIf ConsoleWrite('Drive: ' & $Drive & @CR) ConsoleWrite('Cylinders: ' & DllStructGetData($tDISK_GEOMETRY_EX, 'Cylinders') & @CR) ConsoleWrite('Tracks per Cylinder: ' & DllStructGetData($tDISK_GEOMETRY_EX, 'TracksPerCylinder') & @CR) ConsoleWrite('Sectors per Track: ' & DllStructGetData($tDISK_GEOMETRY_EX, 'SectorsPerTrack') & @CR) ConsoleWrite('Bytes per Sector: ' & DllStructGetData($tDISK_GEOMETRY_EX, 'BytesPerSector') & ' bytes' & @CR) ConsoleWrite('Total Space: ' & DllStructGetData($tDISK_GEOMETRY_EX, 'DiskSize') & ' bytes' & @CR& @CR) ConsoleWrite('-------------------------------' & @CR) $Drive +=1 WEnd1 point