Skip to content

Commit 4699c1b

Browse files
committed
Address Thread Synchronization Issue
1 parent 08fceb9 commit 4699c1b

16 files changed

+31
-45
lines changed

Build/Release/x64/repacls.exe

1.23 KB
Binary file not shown.

Build/Release/x86/repacls.exe

-3.27 KB
Binary file not shown.

Build/Repacls.zip

7.57 KB
Binary file not shown.

Build/build.cmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ CLS
44
SET PATH=%WINDIR%\system32;%WINDIR%\system32\WindowsPowerShell\v1.0
55

66
:: cert info to use for signing
7-
SET CERT=BC4F81C0B3B32755A8CC9A6B91713958294788F0
7+
SET CERT=055E5F445405B24790B32F75FE9049884F2F3788
88
set TSAURL=http://time.certum.pl/
99
set LIBNAME=Repacls
1010
set LIBURL=https://github.com/NoMoreFood/Repacls

Main.cpp

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,15 @@ VOID BeginScan(Processor & oProcessor)
3333
if (OperationPathMode::GetPathMode() == SE_REGISTRY_KEY) oObject = new ObjectRegistry(oProcessor);
3434
if (OperationPathMode::GetPathMode() == SE_DS_OBJECT) oObject = new ObjectAds(oProcessor);
3535

36-
// to track threads that are running
37-
bool ProcessingStarted = false;
38-
3936
// startup some threads for processing
4037
std::vector<std::thread> oThreads;
4138
oProcessor.GetQueue().SetWaiterCounter(InputOutput::MaxThreads());
4239
for (USHORT iNum = 0; iNum < InputOutput::MaxThreads(); iNum++)
43-
oThreads.push_back(std::thread([&ProcessingStarted,&oProcessor,oObject]() {
40+
oThreads.push_back(std::thread([&oProcessor,oObject]() {
4441
for (;;)
4542
{
43+
// fetch next entry
4644
ObjectEntry oEntry = oProcessor.GetQueue().Pop();
47-
ProcessingStarted = true;
4845

4946
// break out if entry flags a termination
5047
if (oEntry.ObjectType == SE_UNKNOWN_OBJECT_TYPE) return;
@@ -64,10 +61,7 @@ VOID BeginScan(Processor & oProcessor)
6461
}
6562

6663
// wait for queue to be completely empty
67-
while (!ProcessingStarted)
68-
{
69-
oProcessor.GetQueue().WaitForEmptyQueues();
70-
}
64+
oProcessor.GetQueue().WaitForEmptyQueues();
7165

7266
// send in some empty entries to tell the thread to stop waiting
7367
for (USHORT iNum = 0; iNum < InputOutput::MaxThreads(); iNum++)

Object.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class Object
1414

1515
public:
1616

17-
virtual void GetBaseObject(std::wstring_view sPath) = 0;
17+
virtual void GetBaseObject(std::wstring sPath) = 0;
1818
virtual void GetChildObjects(ObjectEntry& oObject) = 0;
1919

2020
Object(Processor& poProcessor) : oProcessor(poProcessor) {}

ObjectAds.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#pragma comment(lib,"activeds.lib")
1212
#pragma comment(lib,"adsiid.lib")
1313

14-
void ObjectAds::GetBaseObject(std::wstring_view sPath)
14+
void ObjectAds::GetBaseObject(std::wstring sPath)
1515
{
1616
// initialize com for this thread
1717
InitThreadCom();

ObjectAds.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ class ObjectAds : public Object
77
public:
88

99
// overrides
10-
void GetBaseObject(std::wstring_view sPath) override;
10+
void GetBaseObject(std::wstring sPath) override;
1111
void GetChildObjects(ObjectEntry& oEntry) override;
1212

1313
// constructors

ObjectFile.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#include "DriverKitPartial.h"
77
#include "OperationDepth.h"
88

9-
void ObjectFile::GetBaseObject(std::wstring_view sPath)
9+
void ObjectFile::GetBaseObject(std::wstring sPath)
1010
{
1111
// make a local copy of the path since we may have to alter it
1212
// handle special case where a drive root is specified

ObjectFile.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class ObjectFile : public Object
1111
public:
1212

1313
// overrides
14-
void GetBaseObject(std::wstring_view sPath) override;
14+
void GetBaseObject(std::wstring sPath) override;
1515
void GetChildObjects(ObjectEntry& oEntry) override;
1616

1717
// constructors

0 commit comments

Comments
 (0)