Jump to content

adamxp

Members
  • Posts

    12
  • Joined

  • Last visited

adamxp's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. Thanks guys that answers my question. If it comes to it I could always rewrite the code it wasn't that complicated, I just wanted to save some time and include the code. I will include the code inside my own code and in that functions comments give credit like I planned on doing.
  2. http://msdn.microsoft.com/en-us/library/windows/desktop/aa366071%28v=vs.85%29.aspx
  3. Hello, I have a quick question if people post code without a license, what is assumed on this forum? Its always good pratice to include the author in the comments but I don't see anything specific that gives any indication as to if I have the right to copy and include in my code. For one, I don't want legal trouble and second I couldn't find an answer anywhere for this question. It will be helpful to clarify what license is assumed when posting source code on this forum.
  4. If the shortcut exists you can retrieve it: Read ---------------------------------------------------------------------------------------- $strTargetPath = "C:\hello.lnk" $ShellObj=ObjCreate("WScript.Shell") $objShortcut = $ShellObj.CreateShortCut($strTargetPath) $hotkey = $objShortcut.Hotkey ConsoleWrite($hotkey) Write ---------------------------------------------------------------------------------------- $strTargetPath = "C:\hello.lnk" $hotkey = "Alt+Ctrl+F" $ShellObj=ObjCreate("WScript.Shell") $objShortcut = $ShellObj.CreateShortCut($strTargetPath) $objShortcut.Hotkey = $hotkey $objShortcut.Save ConsoleWrite($hotkey)
  5. Thanks for trying but the code didn't work when appended to the function I already created. There must be a logic error in the way I am using the device io function call PARTITION_SET_EX_MBR but this is way over my head. I just want to thank for your help, and let you know I hav'nt given up I will continue on trying to get this function working. I am completely new to calling api's and must seem like a complete idiot but I am trying to learn there just does not seem to be much information on how to use the IOCTL_DISK_SET_PARTITION_INFO_EX. I am crossing my fingers that an expert may come on this forum topic and bail me out. Me being in the deep end and just learning on how to swim is a bad combination (sorry for the bad analogy) so I better get out before I drown. I naively thought if I could find some examples code for this dll api call on the internet that I could adapt and change them to meet my needs. However there is very little information on these Win Api functions and no information on how to use or code them in autoit. So I am stumped
  6. yes, sorry I am new to the dllstructure syntax and would appreciate really any help you could provide
  7. yes, the #RequireAdmin is in the script, but the function still does not change the MBR data
  8. Each time the below function is called the mbr is not changed... please help an example call, _SetMBRPartitionType("\\.\e:",$PARTITION_HIDDEN_FAT32) Local Const $PARTITION_IFS = 7 ; IFS Partition Local Const $PARTITION_FAT32 = 11 ; FAT32 Local Const $PARTITION_FAT32_XINT13 = 12 ; FAT32 using extended int13 services Local Const $PARTITION_HIDDEN_FAT32 = 27 ; Hidden WIN95 OSR2 32-bit FAT Local Const $PARTITION_HIDDEN_FAT32_LBA = 28 ; Hidden WIN95 OSR2 32-bit FAT, LBA-mapped Local Const $FILE_ANY_ACCESS = 0 Local Const $PARTITION_STYLE_MBR = 0 Local Const $FILE_SHARE_NEITHER = 0 Local Const $FILE_OPEN_EXISTING = 3 Local Const $FILE_ATTRIBUTE_NORMAL = 128 Local Const $IOCTL_DISK_SET_PARTITION_INFO = 0x7C008 Local Const $IOCTL_DISK_UPDATE_PROPERTIES = 0x70140 Func _SetMBRPartitionType($sDevice, $sType) Local Const $tagPARTITION_SET_MBR = "short;ubyte "& $sType;" Local Const $tagPARTITION_SET_EX_MBR = _ "int " & $PARTITION_STYLE_MBR & ;" & _ $tagPARTITION_SET_MBR;" Local $tPIX = DllStructCreate($tagPARTITION_SET_EX_MBR) Local $hDevice Local $a_hCall, $a_iCall $a_hCall = DllCall("kernel32.dll", "hwnd", "CreateFile", _ "str", $sDevice, _ "dword", $FILE_ANY_ACCESS, _ "dword", 0, _ "ptr", $FILE_SHARE_NEITHER, _ "dword", $FILE_OPEN_EXISTING, _ "dword", $FILE_ATTRIBUTE_NORMAL, _ "ptr", 0) $hDevice = $a_hCall[0] $a_iCall = DllCall("kernel32.dll", "int", "DeviceIoControl", _ "hwnd", $hDevice, _ "dword", $IOCTL_DISK_SET_PARTITION_INFO_EX, _; IOCTL_DISK_SET_PARTITION_INFO_EX "ptr", DllStructGetPtr($tPIX), _ "dword", DllStructGetSize($tPIX), _ "ptr", 0, _ "dword", 0, _ "dword*", 0, _ "ptr", 0) $a_iCall = DllCall("kernel32.dll", "int", "DeviceIoControl", _ "hwnd", $hDevice, _ "dword", $IOCTL_DISK_UPDATE_PROPERTIES, _; IOCTL_DISK_UPDATE_PROPERTIES "ptr", 0, _ "dword", 0, _ "ptr", 0, _ "dword", 0, _ "dword*", 0, _ "ptr", 0) DllCall("kernel32.dll", "int", "CloseHandle", "hwnd", $hDevice) EndFunc
  9. Got the code working by making these changes: Local Const $tagPARTITION_INFORMATION_MBR = "uint PartitionType;ubyte BootIndicator;ubyte RecognizedPartition;uint HiddenSectors;" ConsoleWrite(@TAB & "PartitionType: " & "0x" & Hex(DllStructGetData($tPIX, "PartitionType"),2) & @CRLF) Thanks for the help
  10. I found the post below: http://www.autoitscript.com/forum/index.php?showtopic=105701 But the code does not appear to return the mbr data even when $tpix is change to point to the MBR dll structure constaint. code modified: Local $tPIX = DllStructCreate($tagPARTITION_INFORMATION_EX_MBR) ConsoleWrite(@TAB & "PartitionType: " & DllStructGetData($tPIX, "PartitionType") & @CRLF) returns zero each time
  11. Thanks water, I did check out that project already but the project is abandoned?? (no update since 07) and no longer works. Also the XP (vista/server 08/Windows 7 do) version of diskpart does not have the set id command required to change the partition type.
  12. Need some help importing the Dllcalls to get the partition type and set the partition type. I already have a function to get the correct volume ID that requires the change, but need an example how how to use the deviceiocontrol. IOCTL_DISK_GET_PARTITION_INFO_EX http://msdn.microsoft.com/en-us/library/aa365180(v=VS.85).aspx IOCTL_DISK_SET_PARTITION_INFO_EX http://msdn.microsoft.com/en-us/library/aa365191(v=VS.85).aspx
×
×
  • Create New...