// Copyright 2004-2020 Sandboxie Holdings, LLC 
//
// This program is free software: you can redistribute it and/or modify
//   it under the terms of the GNU General Public License as published by
//   the Free Software Foundation, either version 3 of the License, or
//   (at your option) any later version.
//
//   This program is distributed in the hope that it will be useful,
//   but WITHOUT ANY WARRANTY; without even the implied warranty of
//   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//   GNU General Public License for more details.
//
//   You should have received a copy of the GNU General Public License
//   along with this program.  If not, see <https://www.gnu.org/licenses/>.
//

//---------------------------------------------------------------------------
// Low Level DLL embedded into SbieSvc as a binary resource
//---------------------------------------------------------------------------

//
// we want to make sure that we embed the latest of copy of LowLevel.dll
// whenever LowLevel.dll is rebuilt.  the difficulties are:
//
// - the build utility does not recognize the RCDATA statement below as a
// dependency of SbieSvc on LowLevel
//
// - DLLs files are linked during build pass 2, while resource files are
// compiled during build step 1
//
// - the build utility does not guarantee the order in which it builds
// directories on a multiprocessor system
//
// to address these difficulties:
//
// - this resource file essentially compiles to nothing during
// build pass 1,  because BUILD_UTILITY_PASS2 is not defined.
//
// - the sources file names LowLevel.lib as a dependency, along with
// a corresponding BUILD_CONSUMES statement, and for good measure, also
// the SYNCHRONIZE_PASS2_DRAIN statement.  all this to make sure that
// SbieSvc.exe is linked only after LowLevel.dll has been linked.
//
// - the sources files names LowLevel.res (the compiled output for this
// resource file) as a dependency for linking in build pass 2, and the
// makefile.inc file names LowLevel.dll as a dependency for LowLevel.res.
//
// the end result is that if LowLevel.dll is newer than SbieSvc.exe, then
// this resource file gets recompiled during build pass 2 (linking) for
// SbieSvc.exe, after which SbieSvc.exe is relinked, thus embedding the
// most recent copy of LowLevel.dll.
//

#ifdef BUILD_UTILITY_PASS2

#if MY_ARM64_FLAG
LOWLEVEL  RCDATA     "../low/obj/ARM64/LowLevel.dll"
#elif  MY_WIN64_FLAG
LOWLEVEL  RCDATA     "../low/obj/amd64/LowLevel.dll"
#else
LOWLEVEL  RCDATA     "../low/obj/i386/LowLevel.dll"
#endif // MY_WIN64_FLAG

#endif // BUILD_UTILITY_PASS2
