flat assembler
Message board for the users of flat assembler.

Index > Projects and Ideas > Desktop Icons Position Saver & Restorer

Author
Thread Post new topic Reply to topic
asmfan



Joined: 11 Aug 2006
Posts: 392
Location: Russian
asmfan 11 Oct 2008, 12:07
Program on first run saves position of all desktop icons to unicode-aware file. On 2nd run it restores icons' position accordingly to saved file. If newly created icon isn't in the list it saves its position to file. Position is saved to file even if icon deleted from desktop. If you need new position for old icon just rebuild icons' position database (delete it and create again with new needed icon position).
Unicode program in 2 versions - verbose and silent.
Copyrighted just in case /dunno why but anyway/ Wink - a good tradition to study to.

Tested on XP SP3+ 32bit for windows names (see inside).

If doesn't work please check with WinSpy for correct class & windows names for "SysListView32" child under "Progman".

Known Issue: sometimes (rare) it fail to find needed child window. This related to "busy" explorer while processing messages for retrieving window's name. This behavior is described for findwindow(ex) api.
______
* fixed a bug that overwrites icon positions in ini file with bogus coordinates that were obtained after restoring icons position with "align to grid" option is checked on desktop.
* fixed "xor" bug leading to approx. 1.6% possibility that program will give wrong ini file filename.
* extended buffers now able to hold all possible unicode string sizes.
* fixed issue with "snap to grid" that messed icons while restoring them
* added x64 version


P.S. You can get false positive because it reads Explorer's list control memory via new remote memory allocation/injection.


Description: x64 version
Download
Filename: SaveDesktopIconsPosition_x64.zip
Filesize: 3.75 KB
Downloaded: 967 Time(s)

Description: Silent
Download
Filename: SaveDesktopIconsPositionSilent.rar
Filesize: 2.26 KB
Downloaded: 976 Time(s)

Description: Verbose
Download
Filename: SaveDesktopIconsPosition.rar
Filesize: 2.69 KB
Downloaded: 985 Time(s)


_________________
Any offers?


Last edited by asmfan on 23 Sep 2009, 08:52; edited 5 times in total
Post 11 Oct 2008, 12:07
View user's profile Send private message Reply with quote
sleepsleep



Joined: 05 Oct 2006
Posts: 13048
Location: ˛                             ⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣Posts: 0010456
sleepsleep 11 Oct 2008, 16:43
does it support window location restoration?
i personally think it is an added advantage to have this feature.
(like a standby feature) but let say, when user shutdown their pc, maybe they already got their word opened, excel, and some explorer window. so, he click to save the position, next day or next week, after he switches on his pc, he got has his desktop back like the day he went back.
Post 11 Oct 2008, 16:43
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20448
Location: In your JS exploiting you and your system
revolution 11 Oct 2008, 17:14
sleepsleep wrote:
does it support window location restoration?
i personally think it is an added advantage to have this feature.
(like a standby feature) but let say, when user shutdown their pc, maybe they already got their word opened, excel, and some explorer window. so, he click to save the position, next day or next week, after he switches on his pc, he got has his desktop back like the day he went back.
Already in Windows, it is called hibernation.
Post 11 Oct 2008, 17:14
View user's profile Send private message Visit poster's website Reply with quote
sleepsleep



Joined: 05 Oct 2006
Posts: 13048
Location: ˛                             ⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣Posts: 0010456
sleepsleep 12 Oct 2008, 06:59
but hibernation/standby still requires power right?
i mean for pc that requires shutdown, no more power coming in... hope that clarify. Smile
Post 12 Oct 2008, 06:59
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20448
Location: In your JS exploiting you and your system
revolution 12 Oct 2008, 07:22
Standby requires power to keep the SDRAM contents.

Hibernation only requires disk space, no batteries required.
Post 12 Oct 2008, 07:22
View user's profile Send private message Visit poster's website Reply with quote
sleepsleep



Joined: 05 Oct 2006
Posts: 13048
Location: ˛                             ⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣Posts: 0010456
sleepsleep 12 Oct 2008, 07:46
ic, thanks for the info. but still hope it could save window location and restore. Smile
Post 12 Oct 2008, 07:46
View user's profile Send private message Reply with quote
asmfan



Joined: 11 Aug 2006
Posts: 392
Location: Russian
asmfan 12 Oct 2008, 08:07
Win->Control Panel->Folder Properties->View->Restore windows on Logon. Something like this.
Post 12 Oct 2008, 08:07
View user's profile Send private message Reply with quote
asmfan



Joined: 11 Aug 2006
Posts: 392
Location: Russian
asmfan 16 Oct 2008, 17:33
added "jmp" instruction that fixes bug with overwriting ini file with bogus coordinates for icon when "align to grid" is checked on desktop.
To restore icons with that option checked just run the app several times untill needed result. Or the easiest way - uncheck "align to grid" then run app once, check 'align to grid'.
Post 16 Oct 2008, 17:33
View user's profile Send private message Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 4073
Location: vpcmpistri
bitRAKE 16 Oct 2008, 21:03
Code:
        invoke  GetModuleFileName, ebx, szFile, MAX_PATH
        cmp     eax,MAX_PATH
        jae     @5
        lea     edi,[eax*2+szFile]
        lea     ecx,[eax+1]
        mov     al,'.'
        std
        repne   scasw    
need to insure AH is zero prior to SCASW for this to work as intended since MAX_PATH is greater than 256

_________________
¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup
Post 16 Oct 2008, 21:03
View user's profile Send private message Visit poster's website Reply with quote
asmfan



Joined: 11 Aug 2006
Posts: 392
Location: Russian
asmfan 17 Oct 2008, 13:35
Embarassed yup... seems like it's ANSI but unicode intended
lack of xor here, thanks. It's 4 out of 259 (1.5%) to get wrong result though Laughing
OK i'll fix & extend to unicode string size limits not just MAX_PATH.
Now fixed & code restructed

_________________
Any offers?
Post 17 Oct 2008, 13:35
View user's profile Send private message Reply with quote
asmfan



Joined: 11 Aug 2006
Posts: 392
Location: Russian
asmfan 20 Oct 2008, 11:14
anyone tested it on 64bit OS or on any of Vista? Are there window classes & names the same as on 32bit XP?
Post 20 Oct 2008, 11:14
View user's profile Send private message Reply with quote
asmfan



Joined: 11 Aug 2006
Posts: 392
Location: Russian
asmfan 25 Oct 2008, 14:14
fixed "snap to grid" option is set problem that caused messed icons during restoration process. The cause is that icons "move" each other if overlayed and hence losing positions.
Post 25 Oct 2008, 14:14
View user's profile Send private message Reply with quote
sinsi



Joined: 10 Aug 2007
Posts: 794
Location: Adelaide
sinsi 29 Oct 2008, 10:50
One thing I found from the PSDK about LVM_GETITEM -
Quote:
If the LVIF_TEXT flag is set in the mask member of the LVITEM structure, the pszText member must point to a valid buffer and the cchTextMax member must be set to the number of characters in that buffer. Applications should not assume that the text will necessarily be placed in the specified buffer. The control may instead change the pszText member of the structure to point to the new text, rather than place it in the buffer.

Not sure if it applies to LVM_GETITEMTEXT as well though...
Post 29 Oct 2008, 10:50
View user's profile Send private message Reply with quote
asmfan



Joined: 11 Aug 2006
Posts: 392
Location: Russian
asmfan 29 Oct 2008, 15:56
Nothing about such behaviour of LVM_GETITEMTEXT on msdn also but on LVM_GETITEM it is so. Haven't met such buffer relocation during usage of app, maybe this is related to insufficient buffer size passed which in my case is sufficient enough Smile Hope this LVM_GETITEM remark isn't related LVM_GETITEMTEXT.
Post 29 Oct 2008, 15:56
View user's profile Send private message Reply with quote
asmfan



Joined: 11 Aug 2006
Posts: 392
Location: Russian
asmfan 04 Jun 2009, 09:10
Recently moved to x64 needed some system restoration. Now you can use x64 version of icon saver/restorer in first post.
Post 04 Jun 2009, 09:10
View user's profile Send private message Reply with quote
Pinecone_



Joined: 28 Apr 2008
Posts: 180
Pinecone_ 13 Sep 2009, 14:56
I dont mean to take away from your project, but maybe you should check out fences by stardock.
Post 13 Sep 2009, 14:56
View user's profile Send private message Reply with quote
asmfan



Joined: 11 Aug 2006
Posts: 392
Location: Russian
asmfan 23 Sep 2009, 08:50
nah, it's just a tiny icon restorer for fresh os installation when bunch of icons previously saved and supposed to be on proper place on desktop.
Post 23 Sep 2009, 08:50
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.