Skip to content

Commit

Permalink
Merge pull request #1 from NoMoreFood/development
Browse files Browse the repository at this point in the history
Repacls Version 1.8.0.1
  • Loading branch information
NoMoreFood authored May 9, 2017
2 parents 5017971 + 5479543 commit c08256a
Show file tree
Hide file tree
Showing 11 changed files with 57 additions and 23 deletions.
Binary file added .DS_Store
Binary file not shown.
4 changes: 0 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,7 @@
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
[Xx]64/
[Xx]86/
[Bb]uild/
bld/
[Bb]in/
[Oo]bj/
Expand Down
Binary file added Build/Release/x64/repacls.exe
Binary file not shown.
Binary file added Build/Release/x86/repacls.exe
Binary file not shown.
35 changes: 35 additions & 0 deletions Build/build.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
@ECHO OFF

:: cert info to use for signing
SET CERT=9CC90E20ABF21CDEF09EE4C467A79FD454140C5A
set TSAURL=http://time.certum.pl/
set LIBNAME=Repacls
set LIBURL=https://github.com/NoMoreFood/Repacls

:: do cleanup
FOR %%X IN (Debug Temp .vs) DO (
FORFILES /S /P "%~dp0.." /M "%%X" /C "CMD /C IF @isdir==TRUE RD /S /Q @path"
)
FOR %%X IN (Win32 x64 Debug Release) DO (
FORFILES /S /P "%~dp0.." /M "*.*pdb" /C "CMD /C DEL /Q @path"
FORFILES /S /P "%~dp0.." /M "*.*obj" /C "CMD /C DEL /Q @path"
FORFILES /S /P "%~dp0.." /M "*.log" /C "CMD /C DEL /Q @path"
)

:: setup environment variables based on location of this script
SET BINDIR=%~dp0Release

:: determine 32-bit program files directory
IF DEFINED ProgramFiles SET PX86=%ProgramFiles%
IF DEFINED ProgramFiles(x86) SET PX86=%ProgramFiles(x86)%

:: setup paths
SET PATH=%WINDIR%\system32;%WINDIR%\system32\WindowsPowerShell\v1.0
SET PATH=%PATH%;%PX86%\Windows Kits\10\bin\x64
SET PATH=%PATH%;%PX86%\Windows Kits\8.1\bin\x64

:: sign the main executables
signtool sign /sha1 %CERT% /fd sha1 /tr %TSAURL% /td sha1 /d %LIBNAME% /du %LIBURL% "%BINDIR%\x86\*.exe" "%BINDIR%\x64\*.exe"
signtool sign /sha1 %CERT% /as /fd sha256 /tr %TSAURL% /td sha256 /d %LIBNAME% /du %LIBURL% "%BINDIR%\x86\*.exe" "%BINDIR%\x64\*.exe"

PAUSE
4 changes: 2 additions & 2 deletions Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,8 @@ void AnalzyingQueue()
IO_STATUS_BLOCK IoStatusBlock;
NTSTATUS Status = NtOpenFile(&hFindFile, FILE_LIST_DIRECTORY | SYNCHRONIZE,
&oAttributes, &IoStatusBlock, FILE_SHARE_READ | FILE_SHARE_WRITE,
FILE_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT |
FILE_OPEN_FOR_BACKUP_INTENT | FILE_OPEN_REPARSE_POINT);
FILE_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT | FILE_OPEN_FOR_BACKUP_INTENT |
((oEntry.IsRoot) ? 0 : FILE_OPEN_REPARSE_POINT));

if (Status == STATUS_ACCESS_DENIED)
{
Expand Down
6 changes: 4 additions & 2 deletions OperationFactory.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ class FactoryPlant
}

// convert to uppercase for map matching
std::transform(sCommand.begin(), sCommand.end(), sCommand.begin(), ::toupper);
std::transform(sCommand.begin(), sCommand.end(), sCommand.begin(),
[](const WCHAR c) { return static_cast<WCHAR>(::toupper(c)); });

// remove the first character
sCommand.erase(0, 1);
Expand Down Expand Up @@ -66,7 +67,8 @@ template <class SubType> class ClassFactory : public FactoryPlant

ClassFactory(std::wstring sCommand)
{
std::transform(sCommand.begin(), sCommand.end(), sCommand.begin(), ::toupper);
std::transform(sCommand.begin(), sCommand.end(), sCommand.begin(),
[](const WCHAR c) { return static_cast<WCHAR>(::toupper(c)); });
GetCommands()[sCommand] = this;
};
};
14 changes: 7 additions & 7 deletions OperationHelp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,6 @@ Commands That Do Not Alter Security
ConvertDescriptorToStringSecurityDescriptor(). This command does
not print informational messages other than errors.
/RestoreSecurity <FileName>
The reverse operation of /BackupSecurity. Takes the file name and security
descriptors specified in the file specified and applies them to the file
system. This command does not print informational messages other than
errors.
/FindAccount <Name|Sid>
Reports any instance of an account specified.
Expand Down Expand Up @@ -190,7 +184,7 @@ LR"(
have been littered from the old cacls.exe command that didn't understand
how to set up inheritance.
/ReplaceAccount <SearchAccount> <ReplaceAccount>
/ReplaceAccount <SearchAccount>:<ReplaceAccount>
Search for an account and replace it with another account.
/Report <FileName> <RegularExpression>
Expand All @@ -203,6 +197,12 @@ LR"(
regular expression to refine what part of the security descriptor to scan.
See Other Notes & Limitations section for more information.
/RestoreSecurity <FileName>
The reverse operation of /BackupSecurity. Takes the file name and security
descriptors specified in the file specified and applies them to the file
system. This command does not print informational messages other than
errors.
/SetOwner <Name|Sid>
Will set the owner of the file to the name specified.
Expand Down
3 changes: 2 additions & 1 deletion OperationSharePaths.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,8 @@ OperationSharePaths::OperationSharePaths(std::queue<std::wstring> & oArgList) :
if (sLocalPath.back() != L'\\') sLocalPath += L'\\';

// convert to uppercase
std::transform(sLocalPath.begin(), sLocalPath.end(), sLocalPath.begin(), ::toupper);
std::transform(sLocalPath.begin(), sLocalPath.end(), sLocalPath.begin(),
[](const WCHAR c) { return static_cast<WCHAR>(::toupper(c)); });

// see if the share name matches the regular expression
if (!std::regex_search(tInfo[iEntry].shi2_netname, oMatchRegex)) continue;
Expand Down
2 changes: 1 addition & 1 deletion Version.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#pragma once

#define VERSION_STRING "1.8.0.0"
#define VERSION_STRING "1.8.0.1"
12 changes: 6 additions & 6 deletions repacls.vcxproj
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
Expand All @@ -22,34 +22,34 @@
<ProjectGuid>{0E11E31A-BE5D-4B31-AA8E-DA9AEEC84F37}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>PermChange</RootNamespace>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
<WindowsTargetPlatformVersion>10.0.15063.0</WindowsTargetPlatformVersion>
<ProjectName>repacls</ProjectName>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<PlatformToolset>v141</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>false</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<PlatformToolset>v141</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
Expand Down

0 comments on commit c08256a

Please sign in to comment.