Sign in to follow this  
Followers 0
gamerman2360

ptr

4 posts in this topic

$temp = DllCall("kernel32", "ptr", "GetCommandLineA")
$temp = DllStructCreate("char[32767]", $temp[0])
Global Const $CmdLineRawRaw = DllStructGetData($temp, 1)
$temp = 0
What should the size of the struct be? Should it be the max size of the command line, or is there a way to tell what it is? Also if it is this big will it hurt anything, memory wise? I know what pointers are.. Just not that much on how to use them :whistle:.

Share this post


Link to post
Share on other sites



Why are you doing that to get the command line when you can use the $CmdLineRaw that is built into autoit? You can also use the array $CmdLine[] to get each parameter of the command line.


"So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Well, it started out with me making an _error() function. The string that goes in would be either put in a message box or put into the console depending on whether or not /ErrorStdOut was there. (mostly because I got tired of typing out 'MsgBox(0, "Test", )') I didn't know that /ErrorStdOut is shown in $CmdLineRaw so I went and found this Dll function. Now I'm just worried about how to use pointers that point to strings.

Hmm.. Check this out:

Posted Image

... Nothing in the change log about this.

I guess I could retrieve the string in segments, until I hit a null... The website (http://msdn2.microsoft.com/en-us/library/ms683156.aspx) dosn't really say how many bytes to check for.. unless 'LPTSTR' means something.

Should I stick with what the max length of the command line in CreateProcess?

Edited by gamerman2360

Share this post


Link to post
Share on other sites

Yes, you should stick with the largest amount possible. Though this sounds inefficient, it really doesn't make much of a difference.


"So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0