kaz Posted June 15, 2019 Share Posted June 15, 2019 Hello from france, I need to write a binary value to a propvariant. I found on the forum a function to put a string but nothing else. ; Global Const $tagPROPERTYKEY = $tagGUID & ';DWORD pid' Global Const $tagPROPERTYKEY = 'struct;ulong Data1;ushort Data2;ushort Data3;byte Data4[8];DWORD pid;endstruct' Global $tagPROPVARIANT = _ 'USHORT vt;' & _ ;typedef unsigned short VARTYPE; - in WTypes.h 'WORD wReserved1;' & _ 'WORD wReserved2;' & _ 'WORD wReserved3;' & _ 'LONG;PTR' ;union, use the largest member (BSTRBLOB, which is 96-bit in x64) Local $tPROPVARIANT = DllStructCreate($tagPROPVARIANT) .... ; https://www.autoitscript.com/forum/topic/168099-how-to-prevent-multiple-guis-from-combining-in-the-taskbar/ ; This function is not exposed in any dll, but inlined in propvarutil.h so we need to rewrite it entirely in AutoIt Func _WinAPI_InitPropVariantFromString($sUnicodeString, ByRef $tPROPVARIANT) DllStructSetData($tPROPVARIANT, 'vt', $VT_LPWSTR) Local $aRet = DllCall('Shlwapi.dll', 'LONG', 'SHStrDupW', _ 'WSTR', $sUnicodeString, 'PTR', DllStructGetPtr($tPROPVARIANT) + 8) If @error Then Return SetError(@error, @extended, False) Local $bSuccess = $aRet[0] == 0 ; If fails, zero memory of the current PROPVARIANT struct If (Not $bSuccess) Then $tPROPVARIANT = DllStructCreate($tagPROPVARIANT) Return SetExtended($aRet[0], $bSuccess) EndFunc PROPVARIANT structure : https://docs.microsoft.com/en-us/windows/desktop/api/propidl/ns-propidl-tagpropvariant My knowledge about structure and dll call isn't very well. Anyone can help? Link to comment Share on other sites More sharing options...
kaz Posted June 16, 2019 Author Share Posted June 16, 2019 Anyone to create the structure to be use by DllStructCreate ?? Link to comment Share on other sites More sharing options...
Danyfirex Posted June 17, 2019 Share Posted June 17, 2019 Hello. Could you describe what you're trying to do. maybe share a C++ sample or so. what VARTYPE do you want to write to the structure. Saludos Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut Link to comment Share on other sites More sharing options...
kaz Posted June 17, 2019 Author Share Posted June 17, 2019 Hello, i want to reproduce the code found here : https://github.com/riverar/hashlnk/blob/master/hashlnk.cpp After hash a string, the hash must be insert into a propvariant to be register into a lnk file. The code above work to insert a string, but not for a binary (or hex) value. Thanks for your help. Link to comment Share on other sites More sharing options...
BrewManNH Posted June 19, 2019 Share Posted June 19, 2019 I looked on that page you linked to and can't see where it uses this struct, which function are you looking at that uses this struct, and what EXACTLY are you attempting to do with that code once you've "recreated" it? If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
kaz Posted June 19, 2019 Author Share Posted June 19, 2019 I want to be able to add a shortcut to configuration panel in the WIN X menu. It's only one tweak when i install a new Windows 10. A shortcut must be create, it's ok A string must be hash, it's ok. The hash must be insert into the shortcut, it's this part my problem. I searched and found only one solution near that i wanted : _WinAPI_InitPropVariantFromString(..) With this function, it's possible to insert a string into a shortcut, but it's not exactly that i want. In C++, it's only CComPtr<IPropertyStore> store; hr = lnk->GetPropertyStore(GPS_READWRITE, IID_PPV_ARGS(&store)); CHECKHR(hr, L"Failed to get property store."); PROPVARIANT propValue = {0}; propValue.ulVal = hash; propValue.vt = VT_UI4; hr = store->SetValue(PKEY_WINX_HASH, propValue); CHECKHR(hr, L"Failed to set property store value."); hr = store->Commit(); CHECKHR(hr, L"Failed to write changes to .lnk."); I didn't found a simple way. I hope my explanations are clear. Link to comment Share on other sites More sharing options...
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