rasim Posted March 23, 2008 Share Posted March 23, 2008 I trying to get the number of files in recycle bin and the size of recycle bin, but unsuccessful Global $SHQUERYRBINFO = DllStructCreate("int;int64;int64") DllStructSetData($SHQUERYRBINFO, 1, DllStructGetSize($SHQUERYRBINFO)) $Query = DllCall("shell32.dll", "int", "SHQueryRecycleBin", "str", "C:\", "ptr", DllStructGetPtr($SHQUERYRBINFO)) ConsoleWrite("DllCall return value is: " & $Query[0] & @LF) ConsoleWrite(DllStructGetData($SHQUERYRBINFO, 1) & @LF & _ DllStructGetData($SHQUERYRBINFO, 2) & @LF & _ ; size of recycle bin in bytes DllStructGetData($SHQUERYRBINFO, 3) & @LF) ; number of items in recycle binHelp from MSDN Link to comment Share on other sites More sharing options...
rover Posted March 23, 2008 Share Posted March 23, 2008 (edited) I tested your call, It works try unicode $Query = DllCall("shell32.dll", "int", "SHQueryRecycleBinW", "wstr", "C:\", "ptr", DllStructGetPtr($SHQUERYRBINFO)) DllCall return value is: 0 20 ; what is this value? 4865186 ; size of files 46 ; # of files in my Recycle Bin >Exit code: 0 Time: 0.437 Edited March 23, 2008 by rover I see fascists... Link to comment Share on other sites More sharing options...
rasim Posted March 23, 2008 Author Share Posted March 23, 2008 Thanks, but still not work correctly: DllCall return value is: 0 24 21474836480 ; Size of files (really is 52 MB) 0 ; # of files in my Recycle Bin (really is 5) OS:WinXP (SP2), Langue (Russian) Link to comment Share on other sites More sharing options...
GEOSoft Posted March 23, 2008 Share Posted March 23, 2008 (edited) Thanks, but still not work correctly: DllCall return value is: 0 24 21474836480 ; Size of files (really is 52 MB) 0 ; # of files in my Recycle Bin (really is 5) OS:WinXP (SP2), Langue (Russian)When you are counting files in the RB there are two in there that do not show up when you open it. So when you do get a count it will probably be out by 2. EDIT: No, I was wrong Those files do not show up. BTW, I don't know what that 24 is but it shows the same result for an empty recycle bin as it does for a full one. Edited March 23, 2008 by GEOSoft George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
rover Posted March 23, 2008 Share Posted March 23, 2008 (edited) I see according to the MSDN page for SHQUERYRBINFO Structurethat the parameter "cbSize" is the size of the struct.I get 20, you get 24 for the same call.The unicode version works for me as does Ansihttp://msdn2.microsoft.com/en-us/library/b...803(VS.85).aspxEdit: O.K. This call works in v3.2.8.1 but NOT in v3.2.10.0 and v3.2.11.3 machine with both 3.2.8.1 and beta 3.2.11.3(need to download and try latest beta 3.2.11.4)v3.2.11.3 - Invalid returnDllCall return value is: 0241975684956160>Exit code: 0 Time: 0.469v3.2.8.1 - Valid returnDllCall return value is: 0204865186 ; size of files46 ; # of files in my Recycle Bin>Exit code: 0 I just tried this on another machine (both are XP EN SP2 X86)I get what you get:I have 100meg approx. in recycle binv3.2.10.0 - Invalid returnDllCall return value is: 024 ; same return of 24 instead of 2000Exit code: 0I need to see what services I have turned off on that machineone thing is the machine it works on has been updated recentlythe other machine is on Lan but not allowed online and updates are older.we know this works, perhaps it's an issue with the struct parameters? Edited March 23, 2008 by rover I see fascists... Link to comment Share on other sites More sharing options...
rover Posted March 23, 2008 Share Posted March 23, 2008 this changed struct works in v3.2.11.3 ;Global $SHQUERYRBINFO = DllStructCreate("int;int64;int64") ; v3.2.8.1 Global $SHQUERYRBINFO = DllStructCreate("align 1;int;int64;int64") ; v3.2.11.3 DllStructSetData($SHQUERYRBINFO, 1, DllStructGetSize($SHQUERYRBINFO)) $Query = DllCall("shell32.dll", "int", "SHQueryRecycleBin", "str", "C:\", "ptr", DllStructGetPtr($SHQUERYRBINFO)) ConsoleWrite("DllCall return value is: " & $Query[0] & @LF) ConsoleWrite(DllStructGetData($SHQUERYRBINFO, 1) & @LF & _ ; "cbSize" size of the struct = 20 DllStructGetData($SHQUERYRBINFO, 2) & @LF & _ ; size of recycle bin in bytes DllStructGetData($SHQUERYRBINFO, 3) & @LF) ; number of items in recycle bin I see fascists... Link to comment Share on other sites More sharing options...
rasim Posted March 23, 2008 Author Share Posted March 23, 2008 roverwe know this works, perhaps it's an issue with the struct parameters?Mayb... Link to comment Share on other sites More sharing options...
rasim Posted March 23, 2008 Author Share Posted March 23, 2008 (edited) this changed struct works in v3.2.11.3 ;Global $SHQUERYRBINFO = DllStructCreate("int;int64;int64") ; v3.2.8.1 Global $SHQUERYRBINFO = DllStructCreate("align 1;int;int64;int64") ; v3.2.11.3 DllStructSetData($SHQUERYRBINFO, 1, DllStructGetSize($SHQUERYRBINFO)) $Query = DllCall("shell32.dll", "int", "SHQueryRecycleBin", "str", "C:\", "ptr", DllStructGetPtr($SHQUERYRBINFO)) ConsoleWrite("DllCall return value is: " & $Query[0] & @LF) ConsoleWrite(DllStructGetData($SHQUERYRBINFO, 1) & @LF & _ ; "cbSize" size of the struct = 20 DllStructGetData($SHQUERYRBINFO, 2) & @LF & _ ; size of recycle bin in bytes DllStructGetData($SHQUERYRBINFO, 3) & @LF) ; number of items in recycle binYes! Now it`s work correct! Thank you! But where you find this DllStructCreate("align 1;int;int64;int64")? Edit: Tested on version 3.2.10.0 Edited March 23, 2008 by rasim Link to comment Share on other sites More sharing options...
rover Posted March 23, 2008 Share Posted March 23, 2008 (edited) Yes! Now it`s work correct! Thank you! But where you find this DllStructCreate("align 1;int;int64;int64")?Edit: Tested on version 3.2.10.0 from reading the helpfile (v3.2.11.3) The first thing I noticed was your posted result of 24 for the struct sizemy code returned 20 in v3.2.8.1I saw the changes to DllStructCreate()from 3.2.8.1 (see section on 'structure alignment' in 'Remarks').seeing as nothing else was wrong, i.e. no changes made to accommodate 64bitsupport were a problem here. (in regards to DllCall)It was an inspired guess..however I tried this on my other machine with v3.2.10.0 and it doesn't work.so I compiled in v3.2.11.3 and tried that on it.still no gocompiled on that problem machine in v3.2.10.0 and transfered to other machine works fine.so, therefore there is also something in XP that can prevent this from working.I need to look at that other XP machine and see if I can find out what keeps that dllcall from working.It is the machine thats not currently updated (has no online access, but is SP2+)perhaps a service I have turned off. Edited March 23, 2008 by rover I see fascists... Link to comment Share on other sites More sharing options...
rasim Posted March 23, 2008 Author Share Posted March 23, 2008 roverfrom reading the helpfileDamn! I are unattentive. Help rulez! Thank you! 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