Starstar Posted April 29, 2014 Share Posted April 29, 2014 (edited) How to use "DllStructCreate"? Any hint will be appreciated and thanks in advance........ Edit:: i had also see autoit help file many times and other related topic but i couldn't learn it properly. Edited April 29, 2014 by Starstar Life is like a coin. You can spend it Anyway as you wish and for your kind information. "you can spend it only once." Link to comment Share on other sites More sharing options...
BrewManNH Posted April 29, 2014 Share Posted April 29, 2014 Why do you think you need to use this function? What are you going to be doing with it once you learn how to use 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...
Starstar Posted April 29, 2014 Author Share Posted April 29, 2014 Thanks BrewManNH there are many function that can i call using Dllcall(like Connecting a vpn without using operating system function)but every time dllstructure becomes me crazy.................. Life is like a coin. You can spend it Anyway as you wish and for your kind information. "you can spend it only once." Link to comment Share on other sites More sharing options...
Danyfirex Posted April 29, 2014 Share Posted April 29, 2014 The First: http://en.wikipedia.org/wiki/Data_structure then Autoit Help. Saludos Starstar 1 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...
Starstar Posted April 29, 2014 Author Share Posted April 29, 2014 Danyfirex Thank a lot of you.............. Life is like a coin. You can spend it Anyway as you wish and for your kind information. "you can spend it only once." Link to comment Share on other sites More sharing options...
Starstar Posted April 30, 2014 Author Share Posted April 30, 2014 typedef struct { DWORD dwSize; DWORD dwMask; TCHAR szUserName[UNLEN + 1]; TCHAR szPassword[PWLEN + 1]; TCHAR szDomain[DNLEN + 1]; } RASCREDENTIALS, *LPRASCREDENTIALS; How can i create this structure in autoit? what can i put at the place of dwSize and dwMask? and what does mean of [uNLEN+1]&[PWAN+1]? Microsoft structure Link... and dll function link in witch this structure used Life is like a coin. You can spend it Anyway as you wish and for your kind information. "you can spend it only once." Link to comment Share on other sites More sharing options...
trancexx Posted April 30, 2014 Share Posted April 30, 2014 dwSize is set to the value of DllStructGetSize() of created struct. dwMask is the number choosen by you depending what info you'd want retrieved, and for values of PWLEN and other - google "define PWLEN". Starstar 1 ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
Starstar Posted April 30, 2014 Author Share Posted April 30, 2014 thank trancexx very helpful......... Life is like a coin. You can spend it Anyway as you wish and for your kind information. "you can spend it only once." Link to comment Share on other sites More sharing options...
Starstar Posted April 30, 2014 Author Share Posted April 30, 2014 Thanks a lot of you all.................Please take a glance at my first structure and told me where am i wrong.................... thanks in advance.. Local Const $tagSTRUCT1 = "struct;DWORD var1[100];DWORD var2[100];WCHAR var3[128]; WCHAR var4[128]; WCHAR var5[100]; endstruct" $rasdialstruct =DllStructCreate($tagSTRUCT1) DllStructSetData($rasdialstruct,"var1","500") DllStructSetData($rasdialstruct,"var2","10") DllStructSetData($rasdialstruct,"var3","as5555") $fnd=DllStructSetData($rasdialstruct,"var4","Df4456") DllStructSetData($rasdialstruct,"var5","0") $Size=DllStructGetSize($rasdialstruct) MsgBox(0,"",$Size&" Fnd is = "&$fnd) Happy land .... Life is like a coin. You can spend it Anyway as you wish and for your kind information. "you can spend it only once." Link to comment Share on other sites More sharing options...
Danyfirex Posted April 30, 2014 Share Posted April 30, 2014 (edited) @Starstar You can specificate your structure by name index(no using just var string) could be better. somthing like this: Local $iUserlen=Stringlen("username") Local $iUserPass=StringLen("userpass") Local $iDomLen=StringLen("Domain") $sTagRASCREDENTIALS = "dword dwSize;dword dwMask;wchar szUserName[" & $iUserlen+1 & "];wchar szPassword["& $iUserPass+1 & "];wchar szDomain[" & $iDomLen+1 &"]" saludos Edited April 30, 2014 by Danyfirex Starstar 1 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...
Jeroma Posted April 30, 2014 Share Posted April 30, 2014 This is very usefully for me [color=rgb(51,51,51);] [url=[/color]http://www.reductan.com[color=rgb(51,51,51);]][/color]fast weight loss pills[color=rgb(51,51,51);][/url],[/color] [color=rgb(51,51,51);][url=[/color]http://www.reductan.com[color=rgb(51,51,51);]][/color]how to lose weight[color=rgb(51,51,51);][/url][/color][color=rgb(51,51,51);], [/color][color=rgb(51,51,51);][url=[/color]http://www.reductan.com[color=rgb(51,51,51);]][/color]slimming pills[color=rgb(51,51,51);][/url][/color] Link to comment Share on other sites More sharing options...
Starstar Posted April 30, 2014 Author Share Posted April 30, 2014 @Starstar You can specificate your structure by name index(no using just var string) could be better. somthing like this: Local $iUserlen=Stringlen("username") Local $iUserPass=StringLen("userpass") Local $iDomLen=StringLen("Domain") $sTagRASCREDENTIALS = "dword dwSize;dword dwMask;wchar szUserName[" & $iUserlen+1 & "];wchar szPassword["& $iUserPass+1 & "];wchar szDomain[" & $iDomLen+1 &"]" saludos very very useful............ Life is like a coin. You can spend it Anyway as you wish and for your kind information. "you can spend it only once." Link to comment Share on other sites More sharing options...
Danyfirex Posted April 30, 2014 Share Posted April 30, 2014 (edited) Onother thing. When You set data to the structure: Local $iUserlen=Stringlen("username") Local $iUserPass=StringLen("userpass") Local $iDomLen=StringLen("Domain") $sTagRASCREDENTIALS = "dword dwSize;dword dwMask;wchar szUserName[" & $iUserlen+1 & "];wchar szPassword["& $iUserPass+1 & "];wchar szDomain[" & $iDomLen+1 &"]" Local $tTRASCREDENTIALS=DllStructCreate($sTagRASCREDENTIALS) DllStructSetData($tTRASCREDENTIALS,"dwSize",DllStructGetSize($tTRASCREDENTIALS)) ;or $tTRASCREDENTIALS.dwSize=DllStructGetSize($tTRASCREDENTIALS) ;No need pass the number so "10", just 10 DllStructSetData($tTRASCREDENTIALS,"dwMask",10) ;or $tTRASCREDENTIALS.dwMask=10 Edited April 30, 2014 by Danyfirex 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...
Danyfirex Posted April 30, 2014 Share Posted April 30, 2014 @trancexx is dot access safe as dllstructureset/readdata? 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...
funkey Posted April 30, 2014 Share Posted April 30, 2014 (edited) #define UNLEN 256 // Maximum user name length #define PWLEN 256 // Maximum password length You can not just change the size of a structure! The size has to be constant. Use the values 256 as defined in Lmcons.h ! Edit: #define CNLEN 15 // Computer name length #define DNLEN CNLEN // Maximum domain name length Edited April 30, 2014 by funkey Starstar 1 Programming today is a race between software engineers striving tobuild bigger and better idiot-proof programs, and the Universetrying to produce bigger and better idiots.So far, the Universe is winning. Link to comment Share on other sites More sharing options...
Danyfirex Posted April 30, 2014 Share Posted April 30, 2014 (edited) @funkey I did'nt search that constants. Thank you Fixed code: Local Const $UNLEN=256 ;// Maximum user name length Local Const $PWLEN = 256 ;// Maximum password length Local Const $CNLEN =15 ;// Computer name length Local Const $DNLEN =$CNLEN ;// Maximum domain name length $sTagRASCREDENTIALS = "dword dwSize;dword dwMask;wchar szUserName[" & $UNLEN+1 & "];wchar szPassword["& $PWLEN+1 & "];wchar szDomain[" & $DNLEN+1 &"]" Local $tTRASCREDENTIALS=DllStructCreate($sTagRASCREDENTIALS) DllStructSetData($tTRASCREDENTIALS,"dwSize",DllStructGetSize($tTRASCREDENTIALS)) ;or $tTRASCREDENTIALS.dwSize=DllStructGetSize($tTRASCREDENTIALS) ;No need pass the number so "10", just 10 DllStructSetData($tTRASCREDENTIALS,"dwMask",10) ;or $tTRASCREDENTIALS.dwMask=10 Saludos Edited April 30, 2014 by Danyfirex Starstar 1 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...
Starstar Posted April 30, 2014 Author Share Posted April 30, 2014 @funkey I did'nt search that constants. Thank you Fixed code: Local Const $UNLEN=256 ;// Maximum user name length Local Const $PWLEN = 256 ;// Maximum password length Local Const $CNLEN =15 ;// Computer name length Local Const $DNLEN =$CNLEN ;// Maximum domain name length $sTagRASCREDENTIALS = "dword dwSize;dword dwMask;wchar szUserName[" & $UNLEN+1 & "];wchar szPassword["& $PWLEN+1 & "];wchar szDomain[" & $DNLEN+1 &"]" Local $tTRASCREDENTIALS=DllStructCreate($sTagRASCREDENTIALS) DllStructSetData($tTRASCREDENTIALS,"dwSize",DllStructGetSize($tTRASCREDENTIALS)) ;or $tTRASCREDENTIALS.dwSize=DllStructGetSize($tTRASCREDENTIALS) ;No need pass the number so "10", just 10 DllStructSetData($tTRASCREDENTIALS,"dwMask",10) ;or $tTRASCREDENTIALS.dwMask=10 Saludos Good......... Life is like a coin. You can spend it Anyway as you wish and for your kind information. "you can spend it only once." Link to comment Share on other sites More sharing options...
Starstar Posted April 30, 2014 Author Share Posted April 30, 2014 i am trying to calling a dll function but error 5(bad parameter) comes. Local Const $UNLEN=256 Local Const $PWLEN = 256 Local Const $CNLEN =15 Local Const $DNLEN =$CNLEN $sTagRASCREDENTIALS = "dword dwSize;dword dwMask;wchar szUserName[" & $UNLEN+1 & "];wchar szPassword["& $PWLEN+1 & "];wchar szDomain[" & $DNLEN+1 &"]" Local $tTRASCREDENTIALS=DllStructCreate($sTagRASCREDENTIALS) DllStructSetData($tTRASCREDENTIALS,"dwSize",DllStructGetSize($tTRASCREDENTIALS)) DllStructSetData($tTRASCREDENTIALS,"dwMask",10) DllStructSetData($tTRASCREDENTIALS,"szUserName","gh1010") DllStructSetData($tTRASCREDENTIALS,"szPassword","aghh0") DllStructSetData($tTRASCREDENTIALS,"szDomain","") $phnbook ="C:\Users\Adnan\AppData\Roaming\Microsoft\Network\Connections\Pbk\rasphone.pbk" $entry ="hm" $msg = DllCall("Rasapi32.dll","DWORD","RasSetCredentialsW","wstr",$phnbook,"wstr",$entry,"ptr",DllStructGetPtr($tTRASCREDENTIALS),"BOOl","fClearCredentials") MsgBox(0,"",$msg[0]) Now What can i do? thanks in advance........... Life is like a coin. You can spend it Anyway as you wish and for your kind information. "you can spend it only once." Link to comment Share on other sites More sharing options...
funkey Posted April 30, 2014 Share Posted April 30, 2014 fClearCredentials should be 'TRUE' or 'FALSE' but no string 'fClearCredentials'. Programming today is a race between software engineers striving tobuild bigger and better idiot-proof programs, and the Universetrying to produce bigger and better idiots.So far, the Universe is winning. Link to comment Share on other sites More sharing options...
Starstar Posted April 30, 2014 Author Share Posted April 30, 2014 fClearCredentials should be 'TRUE' or 'FALSE' but no string 'fClearCredentials'. i have also tried like this but result is same..........i always get error 5. Life is like a coin. You can spend it Anyway as you wish and for your kind information. "you can spend it only once." 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