Skip to content

Commit

Permalink
v1.0.1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
steve02081504 committed Aug 4, 2022
1 parent 8f2ff36 commit b0a3230
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 10 deletions.
11 changes: 7 additions & 4 deletions NarThumbnailProvider/GetThumbnail.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

struct DATABLOCK {
PBYTE data;
DWORD size;
int32_t size;
};
void DESTORY(DATABLOCK *dbp) {
free(dbp->data);
Expand Down Expand Up @@ -76,7 +76,10 @@ std::vector<DATABLOCK> GetIconResourcesFromNarFStream(IStream *is) {
::std::u8string_view name((char8_t *)file_info->filename, file_info->filename_size);
if(!name.starts_with(u8".nar_icon/"))
goto next_file;
DATABLOCK tmp = {(PBYTE)malloc(file_info->uncompressed_size), file_info->uncompressed_size};
if(file_info->uncompressed_size>=INT32_MAX)
goto next_file;
int32_t data_size = (int32_t)file_info->uncompressed_size;
DATABLOCK tmp = {(PBYTE)malloc(data_size), data_size};
if(tmp.data) {
mz_zip_reader_entry_save_buffer(reader, tmp.data, tmp.size);
aret.push_back(tmp);
Expand All @@ -100,13 +103,13 @@ std::vector<DATABLOCK> GetIconResourcesFromNarFStream(IStream *is) {
DESTORY(&db);
return {};
}
HICON CreateIconFromMemory(PBYTE iconData, size_t iconDataSize,UINT cx) {
HICON CreateIconFromMemory(PBYTE iconData, int32_t iconDataSize, UINT cx) {
auto offset = LookupIconIdFromDirectoryEx(iconData, TRUE, cx, cx, 0);
return CreateIconFromResourceEx(iconData + offset, iconDataSize - offset, TRUE, 0x30000, cx, cx, 0);
}
HBITMAP GetNARThumbnail(UINT cx,IStream* stream) {
std::vector<DATABLOCK> dbs = GetIconResourcesFromNarFStream(stream);
std::srand(std::time(NULL));
std::srand((unsigned)std::time(NULL));
auto size = dbs.size();
HICON hIcon = NULL;
while(size && !hIcon) {
Expand Down
4 changes: 2 additions & 2 deletions NarThumbnailProvider/NarThumbnailProvider.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@
<GenerateDebugInformation>DebugFastLink</GenerateDebugInformation>
<EnableUAC>false</EnableUAC>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<IgnoreSpecificDefaultLibraries>libcmt.lib;libcmtd.lib;msvcrtd.lib</IgnoreSpecificDefaultLibraries>
<IgnoreSpecificDefaultLibraries>libc.lib;libcmt.lib;libcd.lib;libcmtd.lib;msvcrtd.lib;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
Expand Down Expand Up @@ -207,7 +207,7 @@
<GenerateDebugInformation>DebugFastLink</GenerateDebugInformation>
<EnableUAC>false</EnableUAC>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<IgnoreSpecificDefaultLibraries>libcmt.lib;libcmtd.lib;msvcrtd.lib</IgnoreSpecificDefaultLibraries>
<IgnoreSpecificDefaultLibraries>libc.lib;libcmt.lib;libcd.lib;libcmtd.lib;msvcrtd.lib;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
</Link>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# NAR thumbnail provider
![图片](https://user-images.githubusercontent.com/31927825/159116281-9b32ab89-2bad-433b-85b0-bda347773b77.png)
![downloads](https://img.shields.io/github/downloads/Taromati2/nar-thumbnail-provider/total)
![preview](https://user-images.githubusercontent.com/31927825/159116281-9b32ab89-2bad-433b-85b0-bda347773b77.png)
NAR thumbnail provider for Windows Explorer
[Download latest installer](https://github.com/Taromati2/nar-thumbnail-provider/releases/latest)

# How do I get my nar to support getting thumbnail?
1. Create a `.nar_icon` folder in the root of the archive
![图片](https://user-images.githubusercontent.com/31927825/159008338-4a804873-b08c-4996-9752-7f77dcc11906.png)
![apng](https://user-images.githubusercontent.com/31927825/159008338-4a804873-b08c-4996-9752-7f77dcc11906.png)
2. Place any number of ico files in
When there are multiple ico files, one ico will be randomly selected each time the preview is generated🔮
Given the thumbnail caching mechanism, users may only see one icon from start to end until the drive is cleared up🗑
Expand Down
2 changes: 1 addition & 1 deletion Setup/Product.wxs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="NAR Thumbnail Provider" Language="1033" Version="1.0.1.2" Manufacturer="steve02081504" UpgradeCode="79954f90-34f8-4250-bb0d-3fd7ee59c02e">
<Product Id="*" Name="NAR Thumbnail Provider" Language="1033" Version="1.0.1.3" Manufacturer="steve02081504" UpgradeCode="79954f90-34f8-4250-bb0d-3fd7ee59c02e">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<Condition Message="You need to be an administrator to install this product.">Privileged</Condition>
<MajorUpgrade Schedule="afterInstallInitialize" DowngradeErrorMessage="A newer version of NAR Thumbnail Provider is already installed." />
Expand Down
2 changes: 1 addition & 1 deletion minizip-ng
Submodule minizip-ng updated 1 files
+2 −0 mz_zip.c

0 comments on commit b0a3230

Please sign in to comment.