用MASM32寫的 系統托盤表徵圖管理員 TrayIconMan 0.0.0003

來源:互聯網
上載者:User

功能

  TrayIconMan可以列舉系統托盤區中的表徵圖,提示文本,及它們對應的程式,並控制它們的顯示和隱藏狀態。
  有些網友反映,在windows xp 使用TrayIconMan來隱藏系統托盤表徵圖,表徵圖只是被轉到不活動的地區,並沒有真正地從托盤區消失。
  研究發現在啟用了工作列屬性中“隱藏不活動的表徵圖”功能的電腦中會出現此情況。
  解決方案有兩種:
  一種方法是停用“隱藏不活動的表徵圖”功能
  另一種方法是啟用了“隱藏不活動的表徵圖”功能後,把需要讓其從托盤區消失的表徵圖設定為“總是顯示”
  再用TrayIconMan就可以讓相關表徵圖在托盤區隱藏起來了……

http://download.csdn.net/detail/purpleendurer/4071240

http://purpleendurer.ys168.com/            (\myworks\tools中)

 

0.0.0.3 的改進 

修正了0.0.0.2版中所顯示系統托盤表徵圖對應進程檔案說明符中盤符可能不正確的問題。

 

問題分析 

TrayIconMan在Windows XP運行時,會嘗試使用GetProcessImageFileName來擷取系統托盤表徵圖對應進程檔案說明符。返回的對應檔案說明符的形式是\Device\HardDiskVolume1\Windows\System32\svchost.exe,在轉換成C:\Windows\System32\svchost.exe這樣的格式時,0.0.0.2使用的代碼為:

    push sizeof szProcImage
    lea  eax, szProcImage
    push eax
    push hProc
    call g_lpfnGetProcessImageFileName

    test eax, eax
    jz   @GetProcImgFileSpecRet ;fail

    lea  eax, szProcImage
    invoke locatePathName ;定位檔案路徑名的首位置存在ebx中,如\Windows\System32\svchost.exe
    push eax ; 檔案路徑名的首位置在eax中,push for call lstrcpy()

   ;定位到\Device\HardDiskVolume1
    dec  eax
   ;取最後的數字計算盤符
    mov  al, byte ptr [eax]
    sub  al, '1' - 'C'
    mov  ah, ':'
    mov word ptr g_szProcSpec, ax

    push (offset g_szProcSpec)+2
    ;mov eax, offset g_szProcSpec
    ;inc eax
    ;inc eax
    ;push eax
    call lstrcpy

  這個方法在大多數情況下是正確的,但如果系統中存在沒有分配盤符的分區的話,那就符盤就可能不正確了。
  在0.0.0.3中改用QueryDosDevice()來精確轉換。

 

  附:微軟官網對於擷取進程對應檔案說明符的 best results:

 

For best results use the following

For the best results use the following table to convert paths.

Windows 2000 = GetModuleFileName()
Windows XP x32 = GetProcessImageFileName()
Windows XP x64 = GetProcessImageFileName()
Windows Vista = QueryFullProcessImageName()
Windows 7 = QueryFullProcessImageName()

Note: If you are not aware the API GetProcessImageFileName() returns a kernel DOS device path. You can use the following API to map the device paths to a Win32 format.

引自:http://msdn.microsoft.com/en-us/library/windows/desktop/ms684919(v=vs.85).aspx

檔案資訊 

檔案說明符 : F:\MASM32\pe-works\TrayIconMan\TrayIconMan.exe
屬性 : A---
數位簽章:否
PE檔案:是
語言 : 中文(中國)
檔案版本 : 0.0.0003
說明 : TrayIconMan | 系統托盤表徵圖管理員
著作權 : PurpleEndurer
產品版本 : 0.0.0003
產品名稱 : TrayIconMan
公司名稱 : PurpleEndurer | 紫郢劍俠㊣
合法商標 : PurpleEndurer
內部名稱 : TrayIconMan
源檔案名稱 : TrayIconMan
建立時間 : 2012-2-17 21:7:20
修改時間 : 2012-2-17 22:5:22
大小 : 8704 位元組 8.512 KB
MD5 : d7b0c3b62155b15543fa87a456ca34bf
SHA1: 9BEB81EFAA04A69CF02713D7766FF9BAD62EBA83
CRC32: 8ffff234

 

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.