Yashied Posted March 22, 2011 Author Posted March 22, 2011 Please show me result of the following code. #Include <WinAPIEx.au3> $Drive = DriveGetDrive('ALL') For $i = 1 To $Drive[0] ConsoleWrite($Drive[$i] & ' ') $tData = _WinAPI_GetDriveNumber($Drive[$i]) If IsDllStruct($tData) Then ConsoleWrite(DllStructGetData($tData, 'DeviceNumber') & @CR) Else ConsoleWrite('?' & @CR) EndIf Next My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More...
netegg Posted March 22, 2011 Posted March 22, 2011 Please show me result of the following code. #Include <WinAPIEx.au3> $Drive = DriveGetDrive('ALL') For $i = 1 To $Drive[0] ConsoleWrite($Drive[$i] & ' ') $tData = _WinAPI_GetDriveNumber($Drive[$i]) If IsDllStruct($tData) Then ConsoleWrite(DllStructGetData($tData, 'DeviceNumber') & @CR) Else ConsoleWrite('?' & @CR) EndIf Next It's so sad! This is the result!
Yashied Posted March 22, 2011 Author Posted March 22, 2011 What is the physical disk on which are located C:, F:, and G:? My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More...
netegg Posted March 22, 2011 Posted March 22, 2011 (edited) What is the physical disk on which are located C:, F:, and G:?there are 2 physical disks, one for c:\f:\g: and the other for d:\e: Edited March 22, 2011 by netegg
Yashied Posted March 22, 2011 Author Posted March 22, 2011 ATA, SATA, etc.? My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More...
netegg Posted March 22, 2011 Posted March 22, 2011 ATA, SATA, etc.?but the c:\f:\g: is sata, the d:\e: is the common ide
Yashied Posted March 22, 2011 Author Posted March 22, 2011 Try this. #Include <WinAPIEx.au3> $Drive = DriveGetDrive('ALL') For $i = 1 To $Drive[0] ConsoleWrite($Drive[$i] & ' ') $tData = __WinAPI_GetDriveNumber($Drive[$i]) If IsDllStruct($tData) Then ConsoleWrite(DllStructGetData($tData, 'DeviceNumber') & @CR) Else ConsoleWrite('? - ' & _WinAPI_GetLastErrorMessage() & @CR) EndIf Next Func __WinAPI_GetDriveNumber($sDrive) Local $hFile = _WinAPI_CreateFileEx('\\.\' & $sDrive, 3, 0, 0x06) If Not $hFile Then Return SetError(1, 0, 0) EndIf Local $tSTORAGE_DEVICE_NUMBER = DllStructCreate($tagSTORAGE_DEVICE_NUMBER) Local $Ret = DllCall('kernel32.dll', 'int', 'DeviceIoControl', 'ptr', $hFile, 'dword', $IOCTL_STORAGE_GET_DEVICE_NUMBER, 'ptr', 0, 'dword', 0, 'ptr', DllStructGetPtr($tSTORAGE_DEVICE_NUMBER), 'dword', DllStructGetSize($tSTORAGE_DEVICE_NUMBER), 'dword*', 0, 'ptr', 0) If (@error) Or (Not $Ret[0]) Then $Ret = 0 EndIf _WinAPI_CloseHandle($hFile) If Not IsArray($Ret) Then Return SetError(2, 0, 0) EndIf Return $tSTORAGE_DEVICE_NUMBER EndFunc ;==>__WinAPI_GetDriveNumber My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More...
netegg Posted March 22, 2011 Posted March 22, 2011 Try this. #Include <WinAPIEx.au3> $Drive = DriveGetDrive('ALL') For $i = 1 To $Drive[0] ConsoleWrite($Drive[$i] & ' ') $tData = __WinAPI_GetDriveNumber($Drive[$i]) If IsDllStruct($tData) Then ConsoleWrite(DllStructGetData($tData, 'DeviceNumber') & @CR) Else ConsoleWrite('? - ' & _WinAPI_GetLastErrorMessage() & @CR) EndIf Next Func __WinAPI_GetDriveNumber($sDrive) Local $hFile = _WinAPI_CreateFileEx('\\.\' & $sDrive, 3, 0, 0x06) If Not $hFile Then Return SetError(1, 0, 0) EndIf Local $tSTORAGE_DEVICE_NUMBER = DllStructCreate($tagSTORAGE_DEVICE_NUMBER) Local $Ret = DllCall('kernel32.dll', 'int', 'DeviceIoControl', 'ptr', $hFile, 'dword', $IOCTL_STORAGE_GET_DEVICE_NUMBER, 'ptr', 0, 'dword', 0, 'ptr', DllStructGetPtr($tSTORAGE_DEVICE_NUMBER), 'dword', DllStructGetSize($tSTORAGE_DEVICE_NUMBER), 'dword*', 0, 'ptr', 0) If (@error) Or (Not $Ret[0]) Then $Ret = 0 EndIf _WinAPI_CloseHandle($hFile) If Not IsArray($Ret) Then Return SetError(2, 0, 0) EndIf Return $tSTORAGE_DEVICE_NUMBER EndFunc ;==>__WinAPI_GetDriveNumber the chinese means 'the function is not correct'
Yashied Posted March 22, 2011 Author Posted March 22, 2011 Is it a dynamic volume or RAID? My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More...
JFX Posted March 22, 2011 Posted March 22, 2011 (edited) Great UDF Yashied! There seems to be an old include line in the example script _WinAPI_GetExitCodeProcess.au3 Edited March 22, 2011 by JFX
Ascend4nt Posted March 22, 2011 Posted March 22, 2011 Yashied, You might want to adjust Sharing mode when using many file operations with 'CreateFile' to just FILE_SHARE_READ + FILE_SHARE_WRITE. I've found on more than one occasion that adding 'FILE_SHARE_DELETE' can cause some functions to fail. Don't ask me why, never made any sense to me. However, in the case of drives, there would be no need to add that Share mode anyway. netegg - try changing the '0x6' to just '3' in the '_WinAPI_CreateFileEx()' function call - see if that gives you different results? My contributions: Performance Counters in Windows - Measure CPU, Disk, Network etc Performance | Network Interface Info, Statistics, and Traffic | CPU Multi-Processor Usage w/o Performance Counters | Disk and Device Read/Write Statistics | Atom Table Functions | Process, Thread, & DLL Functions UDFs | Process CPU Usage Trackers | PE File Overlay Extraction | A3X Script Extract | File + Process Imports/Exports Information | Windows Desktop Dimmer Shade | Spotlight + Focus GUI - Highlight and Dim for Eyestrain Relief | CrossHairs (FullScreen) | Rubber-Band Boxes using GUI's (_GUIBox) | GUI Fun! | IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) | Magnifier (Vista+) Functions UDF | _DLLStructDisplay (Debug!) | _EnumChildWindows (controls etc) | _FileFindEx | _ClipGetHTML | _ClipPutHTML + ClipPutHyperlink | _FileGetShortcutEx | _FilePropertiesDialog | I/O Port Functions | File(s) Drag & Drop | _RunWithReducedPrivileges | _ShellExecuteWithReducedPrivileges | _WinAPI_GetSystemInfo | dotNETGetVersions | Drive(s) Power Status | _WinGetDesktopHandle | _StringParseParameters | Screensaver, Sleep, Desktop Lock Disable | Full-Screen Crash Recovery Wrappers/Modifications of others' contributions: _DOSWildcardsToPCRegEx (original code: RobSaunder's) | WinGetAltTabWinList (original: Authenticity) UDF's added support/programming to: _ExplorerWinGetSelectedItems | MIDIEx UDF (original code: eynstyne) (All personal code/wrappers centrally located at Ascend4nt's AutoIT Code)
netegg Posted March 23, 2011 Posted March 23, 2011 I add a line code to see the $hFile, the result like these parameter is 0x6 or 3
Yashied Posted March 24, 2011 Author Posted March 24, 2011 (edited) There seems to be an old include line in the example script _WinAPI_GetExitCodeProcess.au3Thanks. Edited March 24, 2011 by Yashied My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More...
netegg Posted March 25, 2011 Posted March 25, 2011 (edited) Is it a dynamic volume or RAID?No. By the way, i remember the result by using an old version winapiex is correct! i forget that version number. Edited March 25, 2011 by netegg
Yashied Posted March 25, 2011 Author Posted March 25, 2011 I can not reproduce this problem. This is from WinAPIEx 2.5 (the other was not): Func _WinAPI_GetDriveNumber($sDrive) Local $hFile = _WinAPI_CreateFile('\\.\' & $sDrive, 2, 0, 0) If Not $hFile Then Return SetError(1, 0, 0) EndIf Local $tSTORAGE_DEVICE_NUMBER = DllStructCreate($tagSTORAGE_DEVICE_NUMBER) Local $Ret = DllCall('kernel32.dll', 'int', 'DeviceIoControl', 'ptr', $hFile, 'dword', 0x002D1080, 'ptr', 0, 'dword', 0, 'ptr', DllStructGetPtr($tSTORAGE_DEVICE_NUMBER), 'dword', DllStructGetSize($tSTORAGE_DEVICE_NUMBER), 'dword*', 0, 'ptr', 0) If (@error) Or (Not $Ret[0]) Then $Ret = 0 EndIf _WinAPI_FreeHandle($hFile) If Not IsArray($Ret) Then Return SetError(2, 0, 0) EndIf Return SetError(0, 0, $tSTORAGE_DEVICE_NUMBER) EndFunc ;==>_WinAPI_GetDriveNumber My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More...
netegg Posted March 25, 2011 Posted March 25, 2011 (edited) expandcollapse popup#include <WinAPI.au3> Const $IOCTL_STORAGE_BASE = 0x2D Const $IOCTL_STORAGE_QUERY_PROPERTY = _MakeCtrlCode($IOCTL_STORAGE_BASE, 0x500) Const $DFP_RECEIVE_DRIVE_DATA = 0x7C088 Const $tagSTORAGEPROPERTYQUERY = "int PropertyId;int QueryType;byte AdditionalParams" Const $tagSTORAGEDEVICEDESCRIPTOR = "ulong Version;ulong Size;byte DeviceType;" & _ "byte DeviceTypeModifier;byte RemovableMedia;" & _ "byte CommandQueueing;ulong VendorIdOffset;" & _ "ulong ProductIdOffset;ulong ProductRevisionOffset;" & _ "ulong SerialNumberOffset;int BusType;" & _ "ulong RawPropertiesLength;byte RawDeviceProperties" Const $tagDRIVERSTATUS = "byte DriverError;byte IDEStatus;byte Reserved1[2];dword Reserved2[2]" Const $tagIDEREGS = "byte Features;byte SectorCount;byte SectorNumber;byte CylLow;" & _ "byte CylHigh;byte DriveHead;byte Command;byte Reserved" Const $tagSENDCMDOUTPARAMS = "dword Size;" & $tagDRIVERSTATUS Const $tagSENDCMDINPARAMS = "dword Size;" & $tagIDEREGS & ";byte DriveNumber;" & _ "byte Reserved1[3];dword Reserved2[4];byte Buffer" $sPhysDisk = "\\.\PhysicalDrive0" ;i've try the 3 drives! $hDisk = _WinAPI_CreateFile($sPhysDisk, 2, 6, 6, 1) If $hDisk = -1 Then Exit(ConsoleWrite("_WinAPI_CreateFile fails, error code: " & _WinAPI_GetLastError() & @CRLF)) EndIf $tSCIP = DllStructCreate($tagSENDCMDINPARAMS) $tSCOP = DllStructCreate($tagSENDCMDOUTPARAMS & ";char Buffer[1024]") $tQuery = DllStructCreate($tagSTORAGEPROPERTYQUERY) $tDescr = DllStructCreate($tagSTORAGEDEVICEDESCRIPTOR) DllStructSetData($tQuery, "PropertyId", 0) DllStructSetData($tQuery, "QueryType", 0) $iResult = _DeviceIoControl($hDisk, $IOCTL_STORAGE_QUERY_PROPERTY, _ $tQuery, DllStructGetSize($tQuery), _ $tDescr, DllStructGetSize($tDescr)) If $iResult = 0 Then Exit(ConsoleWrite("_DeviceIoControl fails, error code: " & @error & @CRLF)) EndIf If DllStructGetData($tDescr, "BusType") = 2 Then DllStructSetData($tSCIP, "Command", 0xA1) Else DllStructSetData($tSCIP, "Command", 0xEC) EndIf $iResult = _DeviceIoControl($hDisk, $DFP_RECEIVE_DRIVE_DATA, _ $tSCIP, DllStructGetSize($tSCIP), _ $tSCOP, DllStructGetSize($tSCOP)) If $iResult = 0 Then Exit(ConsoleWrite("_DeviceIoControl fails, error code: " & @error & @CRLF)) EndIf Dim $sSerialNum For $i = 21 to 40 Step 2 $sSerialNum &= DllStructGetData($tSCOP, "Buffer", $i + 1) $sSerialNum &= DllStructGetData($tSCOP, "Buffer", $i) Next $sSerialNum = StringReplace($sSerialNum, " ", "") Msgbox(0, "", $sPhysDisk & "'s serial number: " & $sSerialNum) $tSCIP = 0 $tSCOP = 0 $tQuery = 0 $tDescr = 0 _WinAPI_CloseHandle($hDisk) Func _MakeCtrlCode($iDevType, $iFunction, $iMethod = 0, $iAccess = 0) Return bitOR(bitShift($iDevType,-16),bitShift($iAccess, -14),bitShift($iFunction, -2), $iMethod) EndFunc ;==>_MakeCtrlCode Func _DeviceIoControl($hDevice, $iCtrlCode, $pIn, $iIn, $pOut, $iOut, $pOverlapped = 0) Local $iResult If IsDllStruct($pIn) Then $pIn = DllStructGetPtr($pIn) If IsDllStruct($pOut) Then $pOut = DllStructGetPtr($pOut) If IsDllStruct($pOverlapped) Then $pOverlapped = DllStructGetPtr($pOverLapped) $iResult = DllCall("Kernel32.dll", "int", "DeviceIoControl", "ptr", $hDevice, _ "dword", $iCtrlCode, "ptr", $pIn, "dword", $iIn, _ "ptr", $pOut, "dword", $iOut, "int*", 0, "ptr", $pOverlapped) Return SetError(_WinAPI_GetLastError(), $iResult[7], $iResult[0]) EndFunc ;==>_DeviceIoControl i can't remember either. But this seems right! And the funtion _winapi_getdrivernumber also does't get the drive1! Like Under! i've watched all the function about drive in winapiex, and find out the lack may be produced by how to turn the driver letter(as c:, d:, etc) into the physical drive name (as PhysicalDrive0, PhysicalDrive1, etc). Maybe! Edited March 26, 2011 by netegg
netegg Posted March 27, 2011 Posted March 27, 2011 Hi Yashied, Another question about _WinAPI_GetProcessCommandLine. I try my best, but it only returns the parameter parts of the command line. So I search the forum and find under: #include<winapiex.au3> Global Const $tag_PROCESS_BASIC_INFORMATION = "int ExitStatus;ptr PebBaseAddress;ptr AffinityMask;ptr BasePriority;ulong UniqueProcessId;ulong InheritedFromUniqueProcessId;" Func _WinAPI_GetProcessCommandLineFromPID($PID=0) If Not $PID Then $PID = _WinAPI_GetCurrentProcessID() If Not $PID Then Return SetError(1, 0, 0) EndIf EndIf Local $hProcess=DllCall("kernel32.dll", 'int', 'OpenProcess', 'int', 0x410, 'int', False, 'int', $PID) Local $PBI=DllStructCreate($tag_PROCESS_BASIC_INFORMATION) DllCall("ntdll.dll", "int", "ZwQueryInformationProcess", "hwnd", $hProcess[0], "int", 0, "ptr", DllStructGetPtr($PBI), "int", DllStructGetSize($PBI), "int",0) Local $dw=DllStructCreate("ptr") DllCall("kernel32.dll", "int", "ReadProcessMemory", "hwnd", $hProcess[0], "ptr", DllStructGetData($PBI,2) + 0x10, "ptr", DllStructGetPtr($dw), "int", 4, "ptr", 0) Local $uString = DllStructCreate("ushort Length;ushort MaxLength;ptr String") DllCall("kernel32.dll", "int", "ReadProcessMemory", "hwnd", $hProcess[0], "ptr", DllStructGetData($dw, 1)+0x40, "ptr", DllStructGetPtr($uString), "int", DllStructGetSize($uString), "ptr", 0) Local $Ret=DllCall("kernel32.dll", "int", "ReadProcessMemory", "hwnd", $hProcess[0], "ptr", DllStructGetData($uString, "String"), "wstr", 0, "int", DllStructGetData($uString, "Length") + 2, "int*", 0) DllCall("kernel32.dll", 'int', 'CloseHandle', "hwnd", $hProcess[0]) If (@error) Or (Not $Ret[5]) Then $Ret = 0 EndIf _WinAPI_CloseHandle($hProcess[0]) If Not IsArray($Ret) Then Return SetError(1, 0, 0) EndIf Return $Ret[3] EndFunc I add this to the winapiex.au3 for myself. but I think this maybe better than the origin _WinAPI_GetProcessCommandLine. Pls check!
Yashied Posted March 27, 2011 Author Posted March 27, 2011 What's the point? You can use the _WinAPI_GetProcessFileName() function to retrieve the full path to a process file. My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More...
Yashied Posted April 17, 2011 Author Posted April 17, 2011 (edited) The library has been updated.v3.3ChangesAdded the following functions. _WinAPI_BeginBufferedPaint _WinAPI_BufferedPaintClear _WinAPI_BufferedPaintInit _WinAPI_BufferedPaintSetAlpha _WinAPI_BufferedPaintUnInit _WinAPI_CreateDIB _WinAPI_CreateNullRgn _WinAPI_DrawThemeEdge _WinAPI_DrawThemeIcon _WinAPI_DwmInvalidateIconicBitmaps _WinAPI_DwmSetIconicLivePreviewBitmap _WinAPI_DwmSetIconicThumbnail _WinAPI_EndBufferedPaint _WinAPI_GetBufferedPaintBits _WinAPI_GetBufferedPaintDC _WinAPI_GetBufferedPaintTargetDC _WinAPI_GetBufferedPaintTargetRect _WinAPI_GetBoundsRect _WinAPI_GetThemeBackgroundContentRect _WinAPI_GetThemeBackgroundExtent _WinAPI_GetThemeBackgroundRegion _WinAPI_GetThemeBitmap _WinAPI_GetThemeBool _WinAPI_GetThemeEnumValue _WinAPI_GetThemeFilename _WinAPI_GetThemeMetric _WinAPI_GetThemePropertyOrigin _WinAPI_GetThemeString _WinAPI_GetThemeSysBool _WinAPI_GetThemeSysColor _WinAPI_GetThemeSysColorBrush _WinAPI_GetThemeSysFont _WinAPI_GetThemeSysInt _WinAPI_GetThemeSysSize _WinAPI_GetThemeSysString _WinAPI_GetThemeTextExtent _WinAPI_GetThemeTextMetrics _WinAPI_GetThemeTransitionDuration _WinAPI_GetWindowTheme _WinAPI_PaintDesktop _WinAPI_SaveHICONToFile _WinAPI_SetBoundsRectAdded examples for the functions above.Removed the following functions. _WinAPI_DllGetVersion Updated documentation. Edited April 17, 2011 by Yashied My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More...
guinness Posted April 18, 2011 Posted April 18, 2011 Its a shame the Voting system can be turned up all the way to 11 (Spinal Tap >> http://en.wikipedia.org/wiki/Up_to_11) because the new additions are what I have been missing, cheers Yashied. UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now