
"레지스트리" 형식으로 아이콘을 직접 표시하는 방법을 아는 사람이 있나요? 예: "%SystemRoot%\system32\shell32.dll,112", 즉 C:\Windows\System32\shell32.dll,112는 일반적으로 "IconPath" 값에 대한 레지스트리 데이터에 있는 아이콘의 ID입니다. . 경로는 실제이며 "112" 아이콘 코드는 임의의 숫자입니다.
요점은 dll이 수백 개의 아이콘으로 구성되어 있으면 다음과 같은 도구를 사용하더라도 올바른 아이콘을 찾는 것이 번거롭다는 것입니다.아이콘 추출기, 아이콘 위로 커서를 가져가면 아이콘 정보가 표시됩니다. 이러한 모든 도구는 반대 방향으로만 작동하는 것처럼 보입니다. 즉, DLL을 로드해야 하고 다음으로 해당 코드가 있는 아이콘을 찾아야 합니다.
답변1
파일 유형에 대한 아이콘은 알려진 DLL에 포함된 리소스(예: 모든 유형의 이미지, 미디어 등)입니다. 해당 아이콘 번호(또는 아이콘 그룹 색인)는 무작위가 아닙니다. DLL 파일에는 해당 리소스를 저장하는 섹션이 있습니다. 각 아이콘은 고유한 번호로 저장됩니다. 한 가지 유형의 아이콘은 다양한 아이콘 크기, 크기 및 비트 심도로 구성될 수 있습니다. 해당 아이콘 ID는 아이콘 그룹 번호에서 나오므로 사용자가 확대/축소 수준을 변경하면 아이콘 자체가 아닌 아이콘 크기만 변경됩니다.
이는 예를 들어 쉽게 이해할 수 있습니다. 이 경우에는리소스 해커. 다음은 Resource Hacker의 바로가기 파일(.LNK 확장자) 아이콘 스크린샷입니다(아이콘은 다를 수 있음).
그리고 레지스트리 설정은 다음과 같습니다.
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.lnk\ShellNew]
"Handler"="{ceefea1b-3e29-4ef1-b34c-fec79c4f70af}"
"IconPath"="%SystemRoot%\system32\shell32.dll,-16769"
"ItemName"="@shell32.dll,-30397"
"MenuText"="@shell32.dll,-30318"
"NullFile"=""
숫자 "16769"를 확인하고 스크린샷과 일치시키세요. 하지만 어떻게 열 수 있나요?리소스 해커? 답변: 해당 소프트웨어를 다운로드하고 실행 --> shell32.dll
데스크톱/작업 폴더에 복사(또는 dll/exe 파일) --> Resource Hacker 창에서 해당 파일 드래그 --> "아이콘 그룹"을 두 번 클릭 --> 스크롤 그 번호로. 크기 16x16, 20x20 등과 관련하여 하나의 아이콘 그룹에 많은 아이콘이 있음을 확인하십시오. 이는 파일 탐색기에서 다른 확대/축소 수준에 대한 것입니다.
대체 소프트웨어:다음에서 대체 소프트웨어를 찾아보세요.AlternativeTo: 리소스 해커. 다음은 그 중 몇 가지입니다.
추가 자료:
답변2
DLL이 수백 개의 아이콘으로 구성되어 있는 경우 올바른 아이콘을 찾는 것이 번거롭습니다.
다음 Powershell 스크립트를 사용할 수 있습니다 .\DisplayIcon.ps1
.
<#
.SYNOPSIS
Exports an ico and bmp file from a given source to a given destination
.Description
You need to set the Source and Destination locations. First version of a script, I found other examples
but all I wanted to do as grab and ico file from an exe but found getting a bmp useful. Others might find useful
.EXAMPLE
This will run but will nag you for input
.\Icon_Exporter.ps1
.EXAMPLE
this will default to shell32.dll automatically for -SourceEXEFilePath
.\Icon_Exporter.ps1 -TargetIconFilePath 'C:\temp\Myicon.ico' -IconIndexNo 238
.EXAMPLE
This will give you a green tree icon (press F5 for windows to refresh Windows explorer)
.\Icon_Exporter.ps1 -SourceEXEFilePath 'C:/Windows/system32/shell32.dll' -TargetIconFilePath 'C:\temp\Myicon.ico' -IconIndexNo 41
.Notes
Based on http://stackoverflow.com/questions/8435/how-do-you-get-the-icons-out-of-shell32-dll Version 1.1 2012.03.8
New version: Version 1.2 2015.11.20 (Added missing custom assembly and some error checking for novices)
#>
Param (
[parameter(Mandatory = $true)]
[string] $SourceEXEFilePath = 'C:/Windows/system32/shell32.dll',
[parameter(Mandatory = $true)]
[string] $TargetIconFilePath,
[parameter(Mandatory = $False)]
[Int32]$IconIndexNo = 0
)
$code = @"
using System;
using System.Drawing;
using System.Runtime.InteropServices;
namespace System
{
public class IconExtractor
{
public static Icon Extract(string file, int number, bool largeIcon)
{
IntPtr large;
IntPtr small;
ExtractIconEx(file, number, out large, out small, 1);
try
{
return Icon.FromHandle(largeIcon ? large : small);
}
catch
{
return null;
}
}
[DllImport("Shell32.dll", EntryPoint = "ExtractIconExW", CharSet = CharSet.Unicode, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]
private static extern int ExtractIconEx(string sFile, int iIndex, out IntPtr piLargeVersion, out IntPtr piSmallVersion, int amountIcons);
}
}
"@
If (-not (Test-path -Path $SourceEXEFilePath -ErrorAction SilentlyContinue ) ) {
Throw "Source file [$SourceEXEFilePath] does not exist!"
}
[String]$TargetIconFilefolder = [System.IO.Path]::GetDirectoryName($TargetIconFilePath)
If (-not (Test-path -Path $TargetIconFilefolder -ErrorAction SilentlyContinue ) ) {
Throw "Target folder [$TargetIconFilefolder] does not exist!"
}
Try {
If ($SourceEXEFilePath.ToLower().Contains(".dll")) {
Add-Type -TypeDefinition $code -ReferencedAssemblies System.Drawing
$Icon = [System.IconExtractor]::Extract($SourceEXEFilePath, $IconIndexNo, $true)
} Else {
[void][Reflection.Assembly]::LoadWithPartialName("System.Drawing")
[void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
$image = [System.Drawing.Icon]::ExtractAssociatedIcon("$($SourceEXEFilePath)").ToBitmap()
$bitmap = new-object System.Drawing.Bitmap $image
$bitmap.SetResolution(72,72)
$icon = [System.Drawing.Icon]::FromHandle($bitmap.GetHicon())
}
} Catch {
Throw "Error extracting ICO file"
}
Try {
$stream = [System.IO.File]::OpenWrite("$($TargetIconFilePath)")
$icon.save($stream)
$stream.close()
} Catch {
Throw "Error saving ICO file [$TargetIconFilePath]"
}
Write-Host "Icon file can be found at [$TargetIconFilePath]"
# Loosely based on http://www.vistax64.com/powershell/202216-display-image-powershell.html
[void][reflection.assembly]::LoadWithPartialName("System.Windows.Forms")
$img = [System.Drawing.Image]::Fromfile($TargetIconFilePath);
# This tip from http://stackoverflow.com/questions/3358372/windows-forms-look-different-in-powershell-and-powershell-ise-why/3359274#3359274
[System.Windows.Forms.Application]::EnableVisualStyles();
$form = new-object Windows.Forms.Form
$form.Text = "Image Viewer"
$form.Width = $img.Size.Width;
$form.Height = $img.Size.Height;
$pictureBox = new-object Windows.Forms.PictureBox
$pictureBox.Width = $img.Size.Width;
$pictureBox.Height = $img.Size.Height;
$pictureBox.Image = $img;
$form.controls.add($pictureBox)
$form.Add_Shown( { $form.Activate() } )
$form.ShowDialog()
#$form.Show();
예제 출력:
> .\DisplayIcon.ps1 -SourceEXEFilePath 'C:\Windows\system32\shell32.dll' -TargetIconFilePath 'f:\test\Myicon.ico' -IconIndexNo 41
Icon file can be found at [f:\test\Myicon.ico]
노트:
출처: