diff --git a/Build/Release/x64/repacls.exe b/Build/Release/x64/repacls.exe index 9a65d29..fa7494b 100644 Binary files a/Build/Release/x64/repacls.exe and b/Build/Release/x64/repacls.exe differ diff --git a/Build/Release/x86/repacls.exe b/Build/Release/x86/repacls.exe index adfabd6..59d3010 100644 Binary files a/Build/Release/x86/repacls.exe and b/Build/Release/x86/repacls.exe differ diff --git a/Build/Repacls.zip b/Build/Repacls.zip index 1844206..f972019 100644 Binary files a/Build/Repacls.zip and b/Build/Repacls.zip differ diff --git a/Main.cpp b/Main.cpp index 4df3169..10e8725 100644 --- a/Main.cpp +++ b/Main.cpp @@ -35,14 +35,18 @@ VOID BeginScan(Processor & oProcessor) if (OperationPathMode::GetPathMode() == SE_REGISTRY_KEY) oObject = new ObjectRegistry(oProcessor); if (OperationPathMode::GetPathMode() == SE_DS_OBJECT) oObject = new ObjectAds(oProcessor); + // to track threads that are running + bool ProcessingStarted = false; + // startup some threads for processing std::vector oThreads; oProcessor.GetQueue().SetWaiterCounter(InputOutput::MaxThreads()); for (USHORT iNum = 0; iNum < InputOutput::MaxThreads(); iNum++) - oThreads.push_back(std::thread([&oProcessor,oObject]() { + oThreads.push_back(std::thread([&ProcessingStarted,&oProcessor,oObject]() { for (;;) { ObjectEntry oEntry = oProcessor.GetQueue().Pop(); + ProcessingStarted = true; // break out if entry flags a termination if (oEntry.ObjectType == SE_UNKNOWN_OBJECT_TYPE) return; @@ -62,8 +66,11 @@ VOID BeginScan(Processor & oProcessor) } // wait for queue to be completely empty - oProcessor.GetQueue().WaitForEmptyQueues(); - + while (!ProcessingStarted) + { + oProcessor.GetQueue().WaitForEmptyQueues(); + } + // send in some empty entries to tell the thread to stop waiting for (USHORT iNum = 0; iNum < InputOutput::MaxThreads(); iNum++) { diff --git a/ObjectAds.cpp b/ObjectAds.cpp index a80da67..e4d3aa6 100644 --- a/ObjectAds.cpp +++ b/ObjectAds.cpp @@ -48,6 +48,7 @@ void ObjectAds::GetChildObjects(ObjectEntry& oEntry) // enumerate the object as a container ULONG iFetched = 0L; VARIANT vVar; + VariantInit(&vVar); while (SUCCEEDED(ADsEnumerateNext(pEnumerator, 1, &vVar, &iFetched)) && (iFetched > 0)) { CComPtr pADs = nullptr; diff --git a/OperationDepth.cpp b/OperationDepth.cpp index 685f4a6..ee0a5dc 100644 --- a/OperationDepth.cpp +++ b/OperationDepth.cpp @@ -9,12 +9,15 @@ OperationDepth::OperationDepth(std::queue & oArgList, const std::w // exit if there are not enough arguments to parse std::vector sSubArgs = ProcessAndCheckArgs(1, oArgList); - // store off the argument - OperationDepth::MaxDepth() = _wtoi(sSubArgs.at(0).c_str()); - if (OperationDepth::MaxDepth() < 0) + // parse the argument off the argument + const int iDepth = _wtoi(sSubArgs.at(0).c_str()); + if (iDepth < 0) { // complain wprintf(L"ERROR: Invalid depth specified for parameter '%s'.\n", GetCommand().c_str()); exit(-1); } + + // store for dynamic lookup + OperationDepth::MaxDepth() = iDepth; }; diff --git a/Resource.rc b/Resource.rc index 17172ed..756e3dd 100644 Binary files a/Resource.rc and b/Resource.rc differ