Searching way of hidden files was changed
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
[ par1j.exe - version 1.2.8.4 or later ]
|
[ par1j.exe - version 1.3.2.8 or later ]
|
||||||
|
|
||||||
Type "par1j.exe" to see version, test integrity, and show usage below.
|
Type "par1j.exe" to see version, test integrity, and show usage below.
|
||||||
|
|
||||||
@@ -73,7 +73,8 @@ A short filename in a path will be converted to long filename.
|
|||||||
If it is "*", all files in the specified directory are searched.
|
If it is "*", all files in the specified directory are searched.
|
||||||
If these are "*.txt" and "*.doc", files with extensions ".txt" and ".doc"
|
If these are "*.txt" and "*.doc", files with extensions ".txt" and ".doc"
|
||||||
in the specified directory are searched.
|
in the specified directory are searched.
|
||||||
Hidden files are ignored by search. (you can add each by exact filename.)
|
When you don't see hidden files on Windows Explorer, they are ignored by search.
|
||||||
|
If you want to search hidden files, change Windows Explorer setting to see them.
|
||||||
|
|
||||||
verify :
|
verify :
|
||||||
You check files in a recovery set.
|
You check files in a recovery set.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
// common.c
|
// common.c
|
||||||
// Copyright : 2022-02-05 Yutaka Sawada
|
// Copyright : 2023-03-13 Yutaka Sawada
|
||||||
// License : GPL
|
// License : GPL
|
||||||
|
|
||||||
#ifndef _UNICODE
|
#ifndef _UNICODE
|
||||||
@@ -16,6 +16,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
#include <shlobj.h>
|
||||||
#include <shlwapi.h>
|
#include <shlwapi.h>
|
||||||
|
|
||||||
#include "common1.h"
|
#include "common1.h"
|
||||||
@@ -1046,3 +1047,24 @@ int delete_file_recycle(wchar_t *file_path)
|
|||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// エクスプローラーで隠しファイルを表示する設定になってるか調べる
|
||||||
|
unsigned int get_show_hidden(void)
|
||||||
|
{
|
||||||
|
unsigned int rv;
|
||||||
|
SHELLSTATE ssf;
|
||||||
|
|
||||||
|
rv = FILE_ATTRIBUTE_HIDDEN;
|
||||||
|
// Explorer の設定を調べる
|
||||||
|
SHGetSetSettings(&ssf, SSF_SHOWALLOBJECTS | SSF_SHOWSUPERHIDDEN, FALSE);
|
||||||
|
// 隠しファイルを表示するかどうか
|
||||||
|
if (ssf.fShowAllObjects){ // 表示する設定なら
|
||||||
|
rv = FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_SYSTEM;
|
||||||
|
|
||||||
|
// 保護されたオペレーティングシステムファイルを表示するかどうか
|
||||||
|
if (ssf.fShowSuperHidden) // 表示する設定なら
|
||||||
|
rv = INVALID_FILE_ATTRIBUTES;
|
||||||
|
}
|
||||||
|
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -126,6 +126,9 @@ void print_win32_err(void);
|
|||||||
// ファイルをゴミ箱に移す
|
// ファイルをゴミ箱に移す
|
||||||
int delete_file_recycle(wchar_t *file_path);
|
int delete_file_recycle(wchar_t *file_path);
|
||||||
|
|
||||||
|
// エクスプローラーで隠しファイルを表示する設定になってるか調べる
|
||||||
|
unsigned int get_show_hidden(void);
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
// par1_cmd.c
|
// par1_cmd.c
|
||||||
// Copyright : 2022-02-16 Yutaka Sawada
|
// Copyright : 2023-03-14 Yutaka Sawada
|
||||||
// License : GPL
|
// License : GPL
|
||||||
|
|
||||||
#ifndef _UNICODE
|
#ifndef _UNICODE
|
||||||
@@ -223,7 +223,8 @@ static wchar_t * search_files(
|
|||||||
int *list_max, // ファイル・リストの確保サイズ
|
int *list_max, // ファイル・リストの確保サイズ
|
||||||
int *list_len, // ファイル・リストの文字数
|
int *list_len, // ファイル・リストの文字数
|
||||||
int *block_num, // ソース・ブロックの数
|
int *block_num, // ソース・ブロックの数
|
||||||
__int64 *block_size) // ブロック・サイズ (最大ファイル・サイズ)
|
__int64 *block_size, // ブロック・サイズ (最大ファイル・サイズ)
|
||||||
|
unsigned int filter) // 隠しファイルを見つけるかどうか
|
||||||
{
|
{
|
||||||
wchar_t *tmp_p;
|
wchar_t *tmp_p;
|
||||||
int len, l_max, l_off;
|
int len, l_max, l_off;
|
||||||
@@ -252,7 +253,7 @@ static wchar_t * search_files(
|
|||||||
if (FindData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
|
if (FindData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
|
||||||
continue; // フォルダは無視する
|
continue; // フォルダは無視する
|
||||||
|
|
||||||
if ((single_file < 0) && (FindData.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN))
|
if ((single_file < 0) && ((FindData.dwFileAttributes & filter) == filter))
|
||||||
continue; // 検索中は隠し属性が付いてるファイルを無視する
|
continue; // 検索中は隠し属性が付いてるファイルを無視する
|
||||||
|
|
||||||
// フォルダは無視する、ファイル名が重複しないようにする
|
// フォルダは無視する、ファイル名が重複しないようにする
|
||||||
@@ -631,6 +632,7 @@ wmain(int argc, wchar_t *argv[])
|
|||||||
return 1;
|
return 1;
|
||||||
} else { // 入力ファイルの指定
|
} else { // 入力ファイルの指定
|
||||||
int base_len, list_max;
|
int base_len, list_max;
|
||||||
|
unsigned int filter = get_show_hidden();
|
||||||
base_len = wcslen(base_dir);
|
base_len = wcslen(base_dir);
|
||||||
list_max = 0;
|
list_max = 0;
|
||||||
list_buf = NULL;
|
list_buf = NULL;
|
||||||
@@ -659,7 +661,7 @@ wmain(int argc, wchar_t *argv[])
|
|||||||
if (wcspbrk(file_path + base_len, L"*?") == NULL)
|
if (wcspbrk(file_path + base_len, L"*?") == NULL)
|
||||||
j = file_num;
|
j = file_num;
|
||||||
// ファイルを検索する
|
// ファイルを検索する
|
||||||
list_buf = search_files(list_buf, file_path, base_len, j, &file_num, &list_max, &list_len, &source_num, &block_size);
|
list_buf = search_files(list_buf, file_path, base_len, j, &file_num, &list_max, &list_len, &source_num, &block_size, filter);
|
||||||
if (list_buf == NULL)
|
if (list_buf == NULL)
|
||||||
return 1;
|
return 1;
|
||||||
if ((j != -1) && (j == file_num)){ // ファイルが見つかったか確かめる
|
if ((j != -1) && (j == file_num)){ // ファイルが見つかったか確かめる
|
||||||
|
|||||||
Reference in New Issue
Block a user