Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Mar 4, 2025. It is now read-only.
/winfilePublic archive

Commitf24f776

Browse files
author
Craig Wittenberg
committed
v10.0; see readme.md.
1 parentb25c342 commitf24f776

33 files changed

+3756
-976
lines changed

‎src/BagOValues.h‎

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
/********************************************************************
2+
3+
BagOValues.h
4+
5+
Copyright (c) Microsoft Corporation. All rights reserved.
6+
Licensed under the MIT License.
7+
8+
********************************************************************/
9+
10+
#include<map>
11+
#include<vector>
12+
#include<algorithm>
13+
14+
#include"spinlock.h"
15+
16+
usingnamespacestd;
17+
18+
template<classTValue>
19+
classBagOValues
20+
{
21+
typedef pair<wstring, TValue> TPair;
22+
typedef vector<TPair> TVector;
23+
typedeftypename TVector::const_iterator TItr;
24+
25+
SpinLock m_spinlock;
26+
TVector m_Values;
27+
wstring m_lastStr;
28+
TItr m_LastItr;
29+
30+
public:
31+
BagOValues()
32+
{
33+
}
34+
35+
// copies the value, but doesn't assume any memory mangement needs be done
36+
voidAdd(wstring key, TValue value)
37+
{
38+
this->m_spinlock.Lock();
39+
wstring lowered;
40+
lowered.resize(key.size());
41+
transform(key.begin(), key.end(), lowered.begin(), ::tolower);
42+
m_Values.insert(m_Values.end(),make_pair(lowered, value));
43+
44+
m_lastStr.resize(0);// clear this after new data added
45+
this->m_spinlock.Unlock();
46+
}
47+
48+
voidSort()
49+
{
50+
this->m_spinlock.Lock();
51+
sort(m_Values.begin(), m_Values.end());
52+
this->m_spinlock.Unlock();
53+
}
54+
55+
// Retrieve with fPrefix = true means return values for the tree at the point of the query matched;
56+
// we must consume the whole query for anything to be returned
57+
// fPrefix = false means that we only return values when an entire key matches and we match substrings of the query
58+
//
59+
// NOTE: returns a newly allocated vector; must delete it
60+
vector<TValue> *Retrieve(const wstring& query,boolfPrefix =true,unsigned maxResults = ULONG_MAX)
61+
{
62+
wstring lowered;
63+
lowered.resize(query.size());
64+
transform(query.begin(), query.end(), lowered.begin(), ::tolower);
65+
66+
vector<TValue> *results =NULL;
67+
TValue val =TValue();
68+
TPair laspair =make_pair(lowered, val);
69+
70+
this->m_spinlock.Lock();
71+
72+
// if last saved string/iterator is a prefix of the new string, start there
73+
TVector::const_iterator itr;
74+
if (m_lastStr.size() !=0 && lowered.compare(0, m_lastStr.size(), m_lastStr) ==0)
75+
itr = m_LastItr;
76+
else
77+
{
78+
itr =lower_bound(m_Values.begin(), m_Values.end(), laspair, CompareFirst);
79+
80+
m_lastStr = lowered;
81+
m_LastItr = itr;
82+
}
83+
84+
for (; itr != m_Values.end(); itr++)
85+
{
86+
const wstring& key = itr->first;
87+
int cmp = key.compare(0, lowered.size(), lowered);
88+
if (cmp ==0)
89+
{
90+
if (!fPrefix && key.size() != lowered.size())
91+
{
92+
// need exact match (not just prefix); skip
93+
continue;
94+
}
95+
96+
if (results ==NULL)
97+
results =new vector<TValue>();
98+
99+
if (results->size() >= maxResults)
100+
break;
101+
102+
results->insert(results->end(), itr->second);
103+
}
104+
elseif (cmp >0)
105+
{
106+
// iterated past the strings which match on the prefix
107+
break;
108+
}
109+
}
110+
111+
this->m_spinlock.Unlock();
112+
return results;
113+
}
114+
115+
private:
116+
staticboolCompareFirst(const TPair& a,const TPair& b)
117+
{
118+
return a.first < b.first;
119+
}
120+
};
121+

‎src/Winfile.vcxproj‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,12 +208,16 @@
208208
<ClIncludeInclude="dbg.h" />
209209
<ClIncludeInclude="fmifs.h" />
210210
<ClIncludeInclude="lfn.h" />
211+
<ClIncludeInclude="BagOValues.h" />
211212
<ClIncludeInclude="mpr.h" />
212213
<ClIncludeInclude="numfmt.h" />
214+
<ClIncludeInclude="spinlock.h" />
213215
<ClIncludeInclude="suggest.h" />
214216
<ClIncludeInclude="treectl.h" />
215217
<ClIncludeInclude="wfcopy.h" />
216218
<ClIncludeInclude="wfdlgs.h" />
219+
<ClIncludeInclude="wfdocb.h" />
220+
<ClIncludeInclude="wfdrop.h" />
217221
<ClIncludeInclude="wfext.h" />
218222
<ClIncludeInclude="wfexti.h" />
219223
<ClIncludeInclude="wfgwl.h" />
@@ -266,8 +270,10 @@
266270
<ClCompileInclude="wfdlgs3.c" />
267271
<ClCompileInclude="wfdos.c" />
268272
<ClCompileInclude="wfdrives.c" />
273+
<ClCompileInclude="wfdrop.c" />
269274
<ClCompileInclude="wfext.c" />
270275
<ClCompileInclude="wffile.c" />
276+
<ClCompileInclude="wfgoto.cpp" />
271277
<ClCompileInclude="wfinfo.c" />
272278
<ClCompileInclude="wfinit.c" />
273279
<ClCompileInclude="wfmem.c" />

‎src/lfn.c‎

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,28 @@ WFFindFirst(
4343
// and ORDINARY files too.
4444
//
4545

46-
dwAttrFilter |=ATTR_ARCHIVE |ATTR_READONLY |ATTR_NORMAL |
47-
ATTR_TEMPORARY |ATTR_COMPRESSED |ATTR_NOT_INDEXED;
48-
lpFind->hFindFile=FindFirstFile(lpName,&lpFind->fd);
46+
PVOIDoldValue;
47+
Wow64DisableWow64FsRedirection(&oldValue);
48+
49+
if ((dwAttrFilter& ~(ATTR_DIR |ATTR_HS))==0)
50+
{
51+
// directories only (hidden or not)
52+
lpFind->hFindFile=FindFirstFileEx(lpName,FindExInfoStandard,&lpFind->fd,FindExSearchLimitToDirectories,NULL,0);
53+
}
54+
else
55+
{
56+
// normal case: directories and files
57+
lpFind->hFindFile=FindFirstFile(lpName,&lpFind->fd);
58+
}
59+
60+
// add in attr_* which we want to include in the match even though the caller didn't request them.
61+
dwAttrFilter |=ATTR_ARCHIVE |ATTR_READONLY |ATTR_NORMAL |ATTR_REPARSE_POINT |
62+
ATTR_TEMPORARY |ATTR_COMPRESSED |ATTR_NOT_INDEXED;
4963

5064
lpFind->fd.dwFileAttributes &=ATTR_USED;
51-
65+
66+
Wow64RevertWow64FsRedirection(oldValue);
67+
5268
//
5369
// Keep track of length
5470
//
@@ -93,6 +109,9 @@ WFFindFirst(
93109
BOOL
94110
WFFindNext(LPLFNDTAlpFind)
95111
{
112+
PVOIDoldValue;
113+
Wow64DisableWow64FsRedirection(&oldValue);
114+
96115
while (FindNextFile(lpFind->hFindFile,&lpFind->fd)) {
97116

98117
lpFind->fd.dwFileAttributes &=ATTR_USED;
@@ -120,9 +139,13 @@ WFFindNext(LPLFNDTA lpFind)
120139
lstrcpy(lpFind->fd.cFileName,lpFind->fd.cAlternateFileName);
121140
}
122141

142+
Wow64RevertWow64FsRedirection(oldValue);
143+
123144
return TRUE;
124145
}
125146

147+
Wow64RevertWow64FsRedirection(oldValue);
148+
126149
lpFind->err=GetLastError();
127150
return(FALSE);
128151
}

‎src/res.rc‎

Lines changed: 51 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ BEGIN
3434
VK_ESCAPE, IDM_ESCAPE, NOINVERT, VIRTKEY
3535
VK_RETURN, IDM_OPEN, NOINVERT, VIRTKEY
3636
VK_RETURN, IDM_OPEN, NOINVERT, VIRTKEY, SHIFT
37+
VK_F12, IDM_EDIT, VIRTKEY
3738
VK_F7, IDM_MOVE, VIRTKEY
3839
VK_F8, IDM_COPY, VIRTKEY
3940
VK_F9, IDM_COPYTOCLIPBOARD, VIRTKEY
@@ -53,31 +54,46 @@ BEGIN
5354
VK_SUBTRACT,IDM_COLLAPSE, NOINVERT, VIRTKEY
5455

5556
VK_RETURN, IDM_ATTRIBS, NOINVERT, VIRTKEY, ALT
56-
VK_F2, IDM_DRIVELISTJUMP, NOINVERT, VIRTKEY
57+
VK_F2, IDM_RENAME, NOINVERT, VIRTKEY
58+
"^x", IDM_CUTTOCLIPBOARD, NOINVERT
59+
"^c", IDM_COPYTOCLIPBOARD, NOINVERT
60+
"^v", IDM_PASTE, NOINVERT
61+
"^k", IDM_STARTCMDSHELL, NOINVERT
62+
"^g", IDM_GOTODIR, NOINVERT
63+
"^f", IDM_SEARCH, NOINVERT
64+
VK_LEFT, IDM_HISTORYBACK, NOINVERT, VIRTKEY, ALT
65+
VK_RIGHT, IDM_HISTORYFWD, NOINVERT, VIRTKEY, ALT
66+
VK_BROWSER_BACK, IDM_HISTORYBACK, NOINVERT, VIRTKEY
67+
VK_BROWSER_FORWARD, IDM_HISTORYFWD, NOINVERT, VIRTKEY
5768
END
5869

5970
FRAMEMENU MENU PRELOAD
6071
BEGIN
6172
POPUP "&File"
6273
BEGIN
6374
MENUITEM "&Open\tEnter", IDM_OPEN
75+
MENUITEM "Edit\tF12", IDM_EDIT
6476
MENUITEM "&Move...\tF7", IDM_MOVE
6577
MENUITEM "&Copy...\tF8", IDM_COPY
66-
MENUITEM "Copy to Clip&board...\tF9", IDM_COPYTOCLIPBOARD
78+
MENUITEM "Copy to Clip&board\tCtrl+C", IDM_COPYTOCLIPBOARD
79+
MENUITEM "Cut to Clipboard\tCtrl+X", IDM_CUTTOCLIPBOARD
80+
MENUITEM"&Paste\tCtrl+V", IDM_PASTE
6781
MENUITEM "&Delete...\tDel", IDM_DELETE
68-
MENUITEM "Re&name...", IDM_RENAME
82+
MENUITEM "Re&name...\tF2", IDM_RENAME
6983
MENUITEM "Proper&ties...\tAlt+Enter",IDM_ATTRIBS
7084
MENUITEM SEPARATOR
7185
MENUITEM "Compre&ss...", IDM_COMPRESS
7286
MENUITEM "&Uncompress...", IDM_UNCOMPRESS
7387
MENUITEM SEPARATOR
7488
MENUITEM "&Run...", IDM_RUN
75-
MENUITEM "&Print...", IDM_PRINT
89+
MENUITEM "Pr&int...", IDM_PRINT
7690
MENUITEM "&Associate...", IDM_ASSOCIATE
7791
MENUITEM SEPARATOR
7892
MENUITEM "Cr&eate Directory...", IDM_MAKEDIR
79-
MENUITEM "Searc&h...", IDM_SEARCH
93+
MENUITEM "Searc&h...\tCtrl+F", IDM_SEARCH
8094
MENUITEM "Select &Files...", IDM_SELECT
95+
MENUITEM "Start Cmd Shel&l...", IDM_STARTCMDSHELL
96+
MENUITEM "&Goto Directory...\tCtrl+G", IDM_GOTODIR
8197
MENUITEM SEPARATOR
8298
MENUITEM "E&xit", IDM_EXIT
8399
END
@@ -110,15 +126,12 @@ BEGIN
110126
MENUITEM "&Name", IDM_VNAME,
111127
MENUITEM "&All File Details", IDM_VDETAILS, CHECKED
112128
MENUITEM "&Partial Details...", IDM_VOTHER
113-
#ifdef PROGMAN
114-
MENUITEM SEPARATOR
115-
MENUITEM "&Icon View" IDM_VICON
116-
#endif
117129
MENUITEM SEPARATOR
118130
MENUITEM "&Sort by Name", IDM_BYNAME
119131
MENUITEM "Sort &by Type", IDM_BYTYPE
120132
MENUITEM "Sort by Si&ze", IDM_BYSIZE
121133
MENUITEM "Sort by &Date", IDM_BYDATE
134+
MENUITEM "Sort &forward Date", IDM_BYFDATE
122135
MENUITEM SEPARATOR
123136
MENUITEM "By File &Type...", IDM_VINCLUDE
124137
END
@@ -165,6 +178,28 @@ BEGIN
165178

166179
END
167180

181+
CTXMENU MENU PRELOAD
182+
BEGIN
183+
POPUP "Dummy Popup"
184+
BEGIN
185+
MENUITEM "&New Window\ton Selection", IDM_NEWWINDOW
186+
MENUITEM "&Open\tEnter", IDM_OPEN
187+
MENUITEM "Edit\tF12", IDM_EDIT
188+
MENUITEM "&Move...\tF7", IDM_MOVE
189+
MENUITEM "&Copy...\tF8", IDM_COPY
190+
MENUITEM "Copy to Clip&board\tCtrl+C", IDM_COPYTOCLIPBOARD
191+
MENUITEM "Cut to Clipboard\tCtrl+X", IDM_CUTTOCLIPBOARD
192+
MENUITEM"&Paste\tCtrl+V", IDM_PASTE
193+
MENUITEM "&Delete...\tDel", IDM_DELETE
194+
MENUITEM "Re&name...\tF2", IDM_RENAME
195+
MENUITEM "Proper&ties...\tAlt+Enter",IDM_ATTRIBS
196+
MENUITEM "&Run...", IDM_RUN
197+
MENUITEM "Start Cmd She&ll...", IDM_STARTCMDSHELL
198+
MENUITEM "&Goto Directory...", IDM_GOTODIR
199+
MENUITEM"About",IDM_ABOUT
200+
END
201+
END
202+
168203

169204
/* 0....5....1....56...2....5....3.2..5....4....5....5....6....5....7....5....8....5....9....5....0....5....1....5....2....5..8 */
170205
STRINGTABLE DISCARDABLE PRELOAD
@@ -210,7 +245,7 @@ BEGIN
210245
Labels cannot contain the following characters:\n[space] * ? / \\ | . , ; : + = [ ] ( ) & ^ < > "" "
211246

212247
IDS_SEARCHNOMATCHES "No matching files were found."
213-
IDS_SEARCHREFRESH "The contents of this drive have changed. Do you want toupdate the Search Results window?"
248+
IDS_SEARCHREFRESH "The contents of this drive have changed. Do you want toretry the Search?"
214249
IDS_LABELACCESSDENIED "You must be logged onto this workstation as an administrator to perform this operation on hard disks."
215250

216251
IDS_DRIVETEMP "Drive %c:%c"
@@ -329,7 +364,6 @@ JAPANEND
329364

330365
IDS_DESTFULL "The destination disk is full. Please insert another disk to continue."
331366
IDS_WRITEPROTECTFILE "This is a system, hidden, or read-only file."
332-
IDS_NOCOPYTOCLIP "File manager cannot copy multiple files or directories to the Clipboard.\n\nSelect a single file, and then try again."
333367

334368
IDS_COPYINGTITLE "Copying..."
335369

@@ -544,9 +578,12 @@ END
544578
STRINGTABLE LOADONCALL MOVEABLE DISCARDABLE
545579
BEGIN
546580
MH_MYITEMS+IDM_OPEN, "Opens selected item"
581+
MH_MYITEMS+IDM_EDIT, "Edits selected item using notepad.exe"
547582
MH_MYITEMS+IDM_MOVE, "Moves selected item"
548583
MH_MYITEMS+IDM_COPY, "Copies files and directories"
549-
MH_MYITEMS+IDM_COPYTOCLIPBOARD, "Copies a file to the clipboard"
584+
MH_MYITEMS+IDM_COPYTOCLIPBOARD, "Copies one or more files to the clipboard"
585+
MH_MYITEMS+IDM_CUTTOCLIPBOARD, "Cuts one or more files to the clipboard"
586+
MH_MYITEMS+IDM_PASTE,"Paste file from clipboard to current directory"
550587
MH_MYITEMS+IDM_COMPRESS, "Compresses a file or directory"
551588
MH_MYITEMS+IDM_UNCOMPRESS, "Uncompresses a file or directory"
552589
MH_MYITEMS+IDM_DELETE, "Deletes files and directories"
@@ -591,6 +628,7 @@ BEGIN
591628
MH_MYITEMS+IDM_BYTYPE, "Sorts files by type"
592629
MH_MYITEMS+IDM_BYSIZE, "Sorts files by size"
593630
MH_MYITEMS+IDM_BYDATE, "Sorts files by date"
631+
MH_MYITEMS+IDM_BYFDATE, "Sorts files by foward date"
594632
MH_MYITEMS+IDM_VINCLUDE, "Shows files of a specified type"
595633

596634
MH_MYITEMS+IDM_CONFIRM, "Controls confirmation messages"
@@ -650,4 +688,4 @@ END
650688

651689
#include "common.ver"
652690

653-

691+


0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp