
OldNoob
Members-
Posts
11 -
Joined
-
Last visited
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
OldNoob's Achievements

Seeker (1/7)
0
Reputation
-
Help with DLLCALL - Kernel32.dll
OldNoob replied to OldNoob's topic in AutoIt General Help and Support
I now have a working version that needs to be cleaned up, when and if the moderators give the ok I will post what I have for discussion- 10 replies
-
- dllcall
- kernel32.dll
-
(and 1 more)
Tagged with:
-
Help with DLLCALL - Kernel32.dll
OldNoob replied to OldNoob's topic in AutoIt General Help and Support
Thanks for the link however I get a file not found message when trying to download the whitepaper. Are there any other resources you can suggest that would help me better understand the DLLStructCreate as well as pulling data from the structure? I do have a legitimate reason for extracting the data however if I'm in violation of breaking the rules then I'll 'cease and desist'. Thanks- 10 replies
-
- dllcall
- kernel32.dll
-
(and 1 more)
Tagged with:
-
Help with DLLCALL - Kernel32.dll
OldNoob replied to OldNoob's topic in AutoIt General Help and Support
So I confirmed the results returned are a list of the Signatures present by converting the returned data using BinaryToString ($aTables[$i]). My goal is to extract the digital product key stored in the MSDM firmware table. I followed the example to get the buffersize and then set up a structure to match Microsoft's spec. I'm reasonably certain I've got the buffersize but I haven't quite figured out how to extract the product key. Thanks #include <Array.au3> #include <MsgBoxConstants.au3> #include <StringConstants.au3> #include <WinAPIDiag.au3> Local $aTables = _EnumSystemFirmwareTables("ACPI") _ArrayDisplay($aTables) Func _EnumSystemFirmwareTables($sSignature) Local $MSDM_FirmwareTable = "struct;CHAR Signature[4];UINT Length;BYTE Revision;BYTE Checksum;CHAR OemId[6];CHAR OemTableId[8];UINT OemRevision;CHAR CreatorId[4];UINT CreatorRevision;CHAR ProductKey[49];endstruct" Local $bTables[1] = [0] Local $bRet = 0 Local $aTables[1] = [0] Local $aRet = DllCall("Kernel32.dll", "uint", "EnumSystemFirmwareTables", "dword", _Signature($sSignature), "ptr", Null, "dword", 0) If @error Or Not $aRet[0] Then Return SetError(@error, @extended, $aTables) Local $iSize = $aRet[0] Local $iBound = $iSize / 4 Local $tFirewareTable = DllStructCreate("dword[" & $iBound & "]") $aRet = DllCall("Kernel32.dll", "uint", "EnumSystemFirmwareTables", "dword", _Signature($sSignature), "ptr", DllStructGetPtr($tFirewareTable), "dword", $iSize) If @error Or Not $aRet[0] Then Return SetError(@error, @extended, $aTables) ReDim $aTables[$iBound + 1] $aTables[0] = UBound($aTables) - 1 For $i = 1 To UBound($aTables) - 1 $aTables[$i] = DllStructGetData($tFirewareTable, 1, $i) $k = BinaryToString ($aTables[$i]) msgbox (0,"", Hex($aTables[$i]) & " : " & $k ,1) if $k = "MSDM" Then $bRet = DllCall("Kernel32.dll", "uint","GetSystemFirmwareTable", "dword", _Signature($sSignature), "dword", _Signature(StringReverse($k)), "ptr", Null, "dword", 0) if @error or Not $bRet[0] Then Return SetError(@error, @extended, $aTables) Local $jsize = $bRet[0] Local $jBound = $jsize / 4 Local $tFirmwareTable = DllStructCreate($MSDM_FirmwareTable) $bTables = DllCall("Kernel32.dll", "uint","GetSystemFirmwareTable", "dword", _Signature($sSignature), "dword", _Signature(StringReverse($k)), "ptr",DllStructGetptr ($tFirmwareTable), "dword", $jBound) $ProductKey = DllStructGetData ($tFirmwareTable, "ProductKey") MsgBox (0,"", $ProductKey,0) $tFirmwareTable = 0 Return ($bTables) endif Next Return $aTables EndFunc ;==>_EnumSystemFirmwareTables Func _Signature($sString) Return "0x" & Hex(Binary($sString)) EndFunc ;==>_Signature- 10 replies
-
- dllcall
- kernel32.dll
-
(and 1 more)
Tagged with:
-
Help with DLLCALL - Kernel32.dll
OldNoob replied to OldNoob's topic in AutoIt General Help and Support
Thank you for those working examples, I'll study the code to get a better understanding of the results they return.- 10 replies
-
- dllcall
- kernel32.dll
-
(and 1 more)
Tagged with:
-
Help with DLLCALL - Kernel32.dll
OldNoob replied to OldNoob's topic in AutoIt General Help and Support
Thanks for the response I am still not understanding though. The following is from Microsoft's documentation UINT WINAPI EnumSystemFirmwareTables( _In_ DWORD FirmwareTableProviderSignature, _Out_ PVOID pFirmwareTableBuffer, _In_ DWORD BufferSize ); Parameters FirmwareTableProviderSignature [in] The identifier of the firmware table provider to which the query is to be directed. This parameter can be one of the following values. Value Meaning 'ACPI' The ACPI firmware table provider. 'FIRM' The raw firmware table provider. Not supported for UEFI systems; use 'RSMB' instead. 'RSMB' The raw SMBIOS firmware table provider. pFirmwareTableBuffer [out] A pointer to a buffer that receives the list of firmware tables. If this parameter is NULL, the return value is the required buffer size. Can you elaborate more on what 'str' I need to first convert? Thanks- 10 replies
-
- dllcall
- kernel32.dll
-
(and 1 more)
Tagged with:
-
I'm attempting to call the winapi function EnumSystemFirmwareTables using DllCall "Kernel32.dll" without success. I am a total noob when it comes to this and could use some direction. Based on the documentation "Dealing with Dlls in AutoIt" by Andreas Karlsson, I have tried using the following code to obtain the buffersize of the Firmware Table Buffer. Thanks in advance for any help #include <WinAPI.au3> MsgBox(0, "ESFT BufferSize", "BufferSize = " & _EnumSystemFirmwareTables()) Func _EnumSystemFirmwareTables() $aRet = DllCall ("Kernel32.dll", "UINT", "EnumSystemFirmwareTables", "DWORD", "ACPI", "PVOID" ,Null , "DWORD" ,Null) if @error Then MsgBox (0,"Error","An error ocurred with the DLLCALL, error returned = " & @error &@CRLF & "GetLastError = " & _WinAPI_GetLastError ( ),0) Exit else Return $aRet endif EndFunc
- 10 replies
-
- dllcall
- kernel32.dll
-
(and 1 more)
Tagged with:
-
Melba23 & KingBob, Thank you both for the explanation. I re-tried by adding $LVS_EX_FULLROWSELECT to the BitOR statement and it worked perfectly. Although functionally not required I find the listview more visually appealing with the gridlines and clientedge. Local $idLV1 = GUICtrlCreateListView( "Column 0|Column 1|Column 2", 125, 145, 250, 250, Default, BitOR($LVS_EX_FULLROWSELECT, $WS_EX_CLIENTEDGE, $LVS_EX_DOUBLEBUFFER, $LVS_EX_GRIDLINES ))
-
Hopefully this thread is not to old to post a reply to... I noticed odd behavior when I modify the line of code that creates the list view Local $idLV1 = GUICtrlCreateListView( "Column 0|Column 1|Column 2", 125, 145, 250, 250, Default, BitOR($WS_EX_CLIENTEDGE, $LVS_EX_DOUBLEBUFFER, $LVS_EX_GRIDLINES ))It seems when anything is added into the extended style field I am only able to select an item in the listview from the first column. I would like to understand why that is? Thanks
-
Melba23, I was unable to work on my script for a considerable time but wanted to let you know I was finally able to get that part of it working without the slow re-write of the Listview occurring. Thanks for your help!
-
Melba23, One of the things I tried was placing my _GUIListViewEx_ChangeItem between _GUICtrlListView_Begin/EndUpdate but it didn't make a difference for me. The size of the list is dependent on the array returned from my SQL Query, it can be as many as 500 records or more but typically under 10. I didn't try to describe it as a problem because it does work, what I see happening when the data is updated is the listview begins to repaint from the first item and then stops at the last item. It seemed like placing _GUIListViewEx_ChangeItem followed by _GUICtrlListViewClickItem between _GUICtrlListView_Begin/EndUpdate should hide the repainting?
-
First time poster so feel feel to correct me if I don't get it quite right. I am creating a listview based on the results of an SQL Query and then allowing the user to change the data by entering the new data into a set of input boxes that match the Query results. All of input boxes are read when the last input box has been entered and then the lisview is updated using the _GUIListViewEx_ChangeItem () function from Melba's UDF. Everything works however I would like to be able to stop the entire listview from repainting after the listview data has been changed. It isn't noticable until the listview contains a large number of items. I suspect I am overlooking something simple but haven't found anything to steer me in the right direction. Thanks! This is the section of code I used to create the listview. All of it borrowed from examples posted here. $hListView = GUICtrlCreateListView("", 200, 94, 700, 140,$LVS_SINGLESEL, BitOR($WS_EX_CLIENTEDGE, $LVS_EX_DOUBLEBUFFER, $LVS_EX_GRIDLINES)) $hListView = GUICtrlGetHandle($hListView) _GUICtrlListView_SetUnicodeFormat($hListView, True) _GUIListViewEx_MsgRegister() $iLV_Index = _GUIListViewEx_Init($hListView, "", 0, Default, 0, 2) _GUIListViewEx_Insert($aSQLQuery) _GUIListViewEx_SetActive($iLV_Index) _GUICtrlListView_ClickItem($hListView, 0)And the code used to change the listview data. For $j = 1 To UBound ($aColHeader) - 1 _GUIListViewEx_ChangeItem($iLV_Index, GUICtrlRead($ItemNumber) - 1, $j, GUICtrlRead($aInputBoxID[$j])) Next _GUICtrlListView_ClickItem($hListView, GUICtrlRead($ItemNumber) - 1)