
- Read more...
-
- 0 comments
- 905 views
typedef enum
{
DEPTH_TEST = 0
// etc... all potential renderstates
} RenderAPIEnum;
typedef enum
{
DX9 = 0,
GL_FPP = 1
// etc... all supported renderers [GL+GLSL, GL+CG, DX+HLSL, DX11, etc.]
} RenderersEnum;
class CRenderAPIInterface
{
public:
virtual bool SetState(RenderAPIEnum RS, DWORD Value) {return false;}
// ...
};
class CRendererBuilder
{
static CRenderAPIInterface* CreateRenderer(RenderersEnum DesiredRenderer);
}
#include "RenderAPIInterface.h"
class CDX9APIInterface : CRenderAPIInterface
{
public:
CDX9APIInterface();
~CDX9APIInterface();
virtual bool SetState(RenderAPIEnum RS, DWORD value);
// ...
};
#include "DX9APIInterface.h"
#include "D3D9.h"
LPDIRECT3DDEVICE9 gDevice = NULL; // assuming a single global device, I'll get into who to
// encapsulate this later.
CDX9APIInterface::CDX9APIInterface()
{
// init gDevice
}
CDX9APIInterface::~CDX9APIInterface()
{
// teardown gDevice
}
bool CDX9APIInterface::SetState(RenderAPIEnum Value, DWORD value)
{
switch (Value)
{
case DEPTH_TEST:
{
gDevice->SetRenderState(D3DRS_ZENABLE, value);
break;
}
default:
{
return false;
}
}
return true;
}
#include "RenderAPIInterface.h"
class CGLFFPAPIInterface : CRenderAPIInterface
{
public:
CGLFFPAPIInterface();
~CGLFFPAPIInterface();
virtual bool SetState(RenderAPIEnum RS, DWORD value);
// ...
};
#include "GLFFPAPIInterface.h"
#include "g/GL.h"
#include "gl/GLU.h"
CGLFFPAPIInterface::CDX9RenderState()
{
// init GL
}
CGLFFPAPIInterface::~CDX9RenderState()
{
// teardown GL
}
bool CGLFFPAPIInterface::SetState(RenderAPIEnum Value, DWORD value)
{
switch (Value)
{
case DEPTH_TEST:
{
::glEnable(GL_DEPTH_TEST);
break;
}
default:
{
return false;
}
}
return true;
}
#include "GLFFPAPIInterface.h"
#include "DX9APIInterface.h"
CRenderAPIInterface* CRendererBuilder::CreateRenderer(RenderersEnum DesiredRenderer)
{
switch (DesiredRenderer)
{
case DX9: return (CRenderAPIInterface*)new CDX9RenderState();
case GL_FPP: return (CRenderAPIInterface*)new CGLFFPAPIInterface();
}
return NULL;
}
class CDX9HLSLAPIInterface : CDX9APIInterface
class CGLGLSLAPIInterface : CGLFFPAPIInterface
CRenderAPIInterface* CRendererBuilder::CreateRenderer(RenderersEnum DesiredRenderer)
{
switch (DesiredRenderer)
{
case DX9: return (CRenderAPIInterface*)new CDX9RenderState();
case GL_FPP: return (CRenderAPIInterface*)new CGLFFPAPIInterface();
case DX9_HLSL:return (CRenderAPIInterface*)new CDX9HLSLAPIInterface();
case DX9_GLSL:return (CRenderAPIInterface*)new CGLGLSLAPIInterface();
}
return NULL;
}
Error 1935. An error occured during the installation of assembly component
{} HRESULT:
Syntax error in manifest or policy file
"C:\windows\winsxs\installtemp\\Assembly1.dll.manifest on line 2
Source=" \Assembly1\Release\Assembly1.dll" KeyPath="yes" Vital="yes" />
Source=" \Assembly1\Release\Assembly1.dll.manifest" Vital="yes" />
Source=" \Assembly1\Release\Assembly1.dll.cat" Vital="yes" />
char * strtok ( char * str, const char * delimiters );
Split string into tokens
A sequence of calls to this function split str into tokens, which are sequences
of contiguous characters separated by any of the characters that are part of
delimiters.
On a first call, the function expects a C string as argument for str, whose
first character is used as the starting location to scan for tokens. In
subsequent calls, the function expects a null pointer and uses the position
right after the end of last token as the new starting location for scanning.
To determine the beginning and the end of a token, the function first scans
from the starting location for the first character not contained in delimiters
(which becomes the beginning of the token). And then scans starting from this
beginning of the token for the first character contained in delimiters, which
becomes the end of the token.
This end of the token is automatically replaced by a null-character by the
function, and the beginning of the token is returned by the function.
Once the terminating null character of str has been found in a call to strtok,
all subsequent calls to this function with a null pointer as the first
argument return a null pointer.
Note:
Each function uses a thread-local static variable for parsing the string into
tokens. Therefore, multiple threads can simultaneously call these functions
without undesirable effects. However, within a single thread, interleaving
calls to one of these functions is highly likely to produce data corruption and
inaccurate results. When parsing different strings, finish parsing one string
before starting to parse the next. Also, be aware of the potential for danger
when calling one of these functions from within a loop where another function
is called. If the other function ends up using one of these functions, an
interleaved sequence of calls will result, triggering data corruption.
Using the statically linked CRT implies that any state information saved by the
C runtime library will be local to that instance of the CRT. For example, if
you use strtok, _strtok_l, wcstok, _wcstok_l, _mbstok, _mbstok_l when using a
statically linked CRT, the position of the strtok parser is unrelated to the
strtok state used in code in the same process (but in a different DLL or EXE)
that is linked to another instance of the static CRT. In contrast, the
dynamically linked CRT shares state for all code within a process that is
dynamically linked to the CRT. This concern does not apply if you use the new
more secure versions of these functions; for example, strtok_s does not have
this problem.
...
lFileLength = File->GetLength();
Data = new TCHAR[lFileLength+1];
File->Read(Data, lFileLength);
Data[lFileLength] = NULL;
File->Close();
char *buffer;
// start our tokenization
buffer = strtok(Data, "\n\r");
...
$ sudo port install subversion
mkdir -p /Library/Subversion/Repository
cd /Library/Subversion/Repository
svnadmin create myRepo
cd myRepo/conf
vi svnserve.conf
vi passwd
[general]
anon-access = none
auth-access = write
password-db = passwd
realm = myRepo on my Dedicated Server
[users]
joe =
matty =
sudo chown -R root:admin /Library/Subversion/Repository
sudo chmod -R ug+rwX,o= /Library/Subversion/Repository
svnserve -d -r /Library/Subversion/Repository
UINT __stdcall MSIMyAppInstall(MSIHANDLE hInstall)
...
Directory of C:\Windows\System32
07/13/2009 09:15 PM 149,019 crtdll.dll
07/13/2009 09:15 PM 690,688 msvcrt.dll
07/13/2009 09:15 PM 253,952 msvcrt20.dll
07/13/2009 09:07 PM 60,928 msvcrt40.dll
...
...
Directory of C:\Windows\winsxs\x86_microsoft-windows-msvcrt_31bf3856ad364e35_6.
1.7600.16385_none_d12b8c440039b31e
07/13/2009 09:15 PM 690,688 msvcrt.dll
...
a) The manifest must have an "Assembly Identity"
*) The identity must have a name.
*) The identity must have a version.
*) The identity must have a type.
*) The identity must have a publicKeyToken.
*) The identity must have a processorArchitecture
*) The identity may have a language [defaults to en]
*) The identity may have a culture [defualts to neutral]
b) The manifest must have
*) The
*) The
*) The
2) The assembly must have a security cabinet.
3) The assembly must be installed into WinSxS with a MSI installer.
4) All exe's, dll's, and the security cabinet must be signed with
a trusted 2048bit certificate.
5) The assembly may have an optional policy to route versions.
Things to note here: Authenticode certificates are 1024bit only and will not
work. You will need to extract your public key token from your code signing
certificate. To make a SxSManifest from C++ you need to feed mt.exe your tlb
and rgs files. To make a SxSManifest from an ocx or a dll you don't have the
source too: you will need to use "regsvr42" to probe the interfaces. I've gone
over how to do all these in my last two weeks entries,
review them for more information.
As difficult as it is to make a WinSxS install: the "Assembly Identity" shows
the true power of it. I've already been spouting about Reg Free COM and
installing multiple simultaneous versions. But look, we also can target 32bit or
64bit by just changing the manifest entry. We can have 32bit and 64bit installed
on the same machine at the same time with the same GUIDS! The client application
just needs a different dependency manifest to select one versus another.
I've not had to use them, but these same manifest tricks allow you to install
multiple language and cultures.
Implications on dependencies:
Manifests go hand in hand with static imports. If you are a windows developer
you have probably used depends.exe. If you have used it recently, you may
have noticed that there are yellow bangs beside some of your import dlls.
Look at that! It claims that it can't find the C runtime! The reason for this
should be obvious: our application uses a manifest to find the C runtime.
Manifests are scripts to program the ActCtx API -- which only exists at
runtime. Depends literally has no way of knowing how to find that dll
since you can edit your manifest to target any version you want.
Like I said a long time ago, If you are using visual stdudio 2005 or higher
you have been using the ActCtx API all along without knowing it. In you look
in your build directory you will notice that the linker automatically produced
a file called MyApp.intermediate.manifest. Depending on what standard libraries
you linked to, it will look something like this:
[With the default compiler settings with file will get embedded as an RT_MAINFEST
at CREATEPROCESS_MANIFEST_RESOURCE_ID for an exe or ISOLATIONAWARE_MANIFEST_RESOURCE_ID for a dll.]
That last entry has our C runtime link!
Linking to that lib causes a static import to exist in our application but
it relays on the ActCtx at runtime to do the mapping!
For our custom dll's we need to be able to advertise entries like that so
that client applications can find us in winsxs. Unfortunately, there is no
tool in visual studio 2005 to do so.
In an earlier post, I had you start moving your winsxs build process
to the pre and post build steps. You need a batch file that is something like
this:
MakeDLLIntoAssembly [RTMBroker Directory] [Component Directory] [Component name] [Component Filename] [Component TLB] [Component Version] [Component PublicKey] [CertName]"
Lets look at my script:
@echo off
rem begin MakeDLLIntoAssembly.bat
if "%1" == "" goto error
cd %2
attrib -r %4
echo Preparing Files for %3 RTM Distribution.
rem Build the required Assembly Identity, and extract Reg Free COM info From the TLB and RGS
%1\bin\mt /nologo -rgs:RTM.rgs -tlb:%5 -dll:%4 -identity:"MyCompanyName.%3, processorArchitecture=x86, version=%6, type=win32, publicKeyToken=%7" -out:%4.sxs.manifest
rem The vs2005 linker will have produced the intermediate manfiest, merge it with the one we created to make a complete one [gives us c runtime, etc]
%1\bin\mt /nologo -manifest %4.sxs.manifest %4.intermediate.manifest -out:%4.manifest
%1\bin\mt /nologo -manifest %4.manifest -outputresource:%4;2
rem Sign our output with the 2048 bit cert
%1\bin\signcode -spc %1\Signing\ssl-cert.crt -v %1\Signing\ssl-cert.pvk -t http://timestamp.verisign.com/scripts/timstamp.dll -n "Company Name" -i "http://
rem Now that we signed it, the file hash will have changed. Re-hash for security to validate.
%1\bin\mt /nologo -manifest %4.manifest -hashupdate -out:%4.manifest
rem Make the security cabinet
%1\bin\mt /nologo -manifest %4.manifest -makecdfs
%1\bin\makecat %4.manifest.cdf
rem Sign the cabinet with the 2048bit cert
%1\bin\signcode -spc %1\Signing\ssl-cert.crt -v %1\Signing\ssl-cert.pvk -t http://timestamp.verisign.com/scripts/timstamp.dll -n "Company Name" -i "http://
rem intermediate file.
del %4.sxs.manifest
rem applications have to be able to reference us as a dependency
rem mt sadly lacks this option directly, so we have to fake it
echo Making Dependeny Manifest
echo ^ > %4.dependentassembly.manifest
echo ^
echo ^
echo ^
echo ^
echo ^
echo ^
echo ^
:error
echo Usage MakeDLLIntoAssembly [RTMBroker Directory] [Component Directory] [Component name] [Component Filename] [Component TLB] [Component Version] [Component PublicKey] [CertName]"
:end
If you read the comments in the code: it will give you all the required pieces for a sxs install. I omitted the code for embedding the interop dll's. I'll
come back to that in a future entry.
One of the important tricks here is the "dependency manifest." Lets look
at the output of what it makes:
Its a just a finger print...
Now to use it when you build your application or game, the linker will give you
the standard intermediate like the one above.
If you add:
mt -manifest mygame.intermediate.manifest MyRenderingEngine.dependency.manifest (-out:MyGame.exe.manifest or -outputresource:mygame.exe;2)"
To your post build step, the manifest tool with merge the two manifest snippets
into one and give you a finalized manifest that looks like:
Now the ActCtx API knows how to find us if we are in winsxs!
If you have a series of libraries: MyRenderer.dll, MyAIEngine.dll,
MyNetworkEngine.dll, etc. You will just need to loop over the mt call
and keep concatenating them together. [The manifest tool only accepts two
manifests at a time, you will have to use an intermediate file.]
After these steps you may still have to tweak your manifest a little more.
If you are running on vista/7 and you need the application to run as
administrator you have to add:
We still have to go over a few topics to finalize this discussion: "local"
assembly manifests, using an MSI to install into WinSXS, and finalizing our
making our interop dll's use reg free com.
Syntax error in manifest or policy file "C:\WINDOWS\WinSxS\Manifests\x86_MyCompany.MyLibrary_d032e2f1f5e7d70c_7.8.9.2_x-ww_f2eac902.Manifest" on line 2.
C:\WINDOWS\WinSxS\Manifests>mt -manifest x86_MyCompany.MyLibrary_d032e2f1f5e7d70c
_7.8.9.2_x-ww_f2eac902.Manifest -validate_manifest
Microsoft (R) Manifest Tool version 5.2.3790.2075
Copyright (c) Microsoft Corporation 2005.
All rights reserved.
Parsing of manifest MyCompany.MyLib_d032e2f1f5e7d70c_7.8.9.2_x-ww_f2eac90
2.Manifest successful.
C:\>sxstrace
WinSxs Tracing Utility.
Usage: SxsTrace [Options]
Options:
Trace -logfile:FileName [-nostop]
Enabling tracing for sxs.
Tracing log is saved to FileName.
If -nostop is specified, will not prompt to stop tracing.
Parse -logfile:FileName -outfile:ParsedFile [-filter:AppName]
Translate the raw trace file into a human readable format and save the re
sult to ParsedFile.
Use -filter option to filter the output.
Stoptrace
Stop the trace if it is not stopped before.
Example: SxsTrace Trace -logfile:SxsTrace.etl
SxsTrace Parse -logfile:SxsTrace.etl -outfile:SxsTrace.txt
INFO: Parsing Manifest File C:\Windows\WinSxS\manifests\x86_mycompany.mylibrary_d032e2f1f5e7d70c_7.8.9.2_none_f4218a7198e4129a.manifest.
INFO: Manifest Definition Identity is MyCompany.MyLibrary,processorArchitecture="x86",publicKeyToken="d032e2f1f5e7d70c",type="win32",version="7.8.9.2".
INFO: Reference: Microsoft.VC80.CRT,processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="8.0.50727.762"
INFO: Reference: Microsoft.VC80.MFC,processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="8.0.50727.762"
INFO: Reference: MyCompany.SomeOtherLib,processorArchitecture="x86",publicKeyToken="d032e2f1f5e7d70c",type="win32",version="7.8.9.2"
ERROR: Activation Context generation failed.
End Activation Context Generation.
tlbimp.exe myLibrary.dll
namespace VTXComputeLib
{
[ComImport, Guid("11D77BD1-500B-477E-91FE-724116A7F9DE"), TypeLibType((short) 0x10c0)]
public interface IVxPanorama
[ComImport, CoClass(typeof(VxPanoramaClass)), Guid("11D77BD1-500B-477E-91FE-724116A7F9DE")]
public interface VxPanorama : IVxPanorama
[ComImport, ClassInterface((short) 0), Guid("10BA6F3D-BB38-4264-BE4D-62A5F5A2D059"), TypeLibType((short) 2)]
public class VxPanoramaClass : IVxPanorama, VxPanorama
}
namespace AxMyControlLib
{
public class AxMyScene : System.Windows.Forms.AxHost
...
public AxMyScene() :
base("77dbba22-ecfc-4c1f-90d2-b081a61c5ebd")
{
}
protected override object CreateInstanceCore(Guid clsid)
{
RetObject = base.CreateInstanceCore(clsid);
}
// ...
}
public class AxMyScene : System.Windows.Forms.AxHost
[System.ComponentModel.DesignTimeVisibleAttribute(true)]
[System.ComponentModel.ToolboxItemAttribute(true)]
public class AxMyScene : System.Windows.Forms.AxHost
public class CActivationContextState
{
////////////////////////////////////////////////////////////
// PInvoke
[DllImport("Kernel32.dll", SetLastError = true)]
private extern static IntPtr CreateActCtx(ref ACTCTX actctx);
[DllImport("Kernel32.dll", SetLastError = true)]
private extern static bool ActivateActCtx(IntPtr hActCtx, out uint lpCookie);
[DllImport("Kernel32.dll", SetLastError = true)]
private extern static bool DeactivateActCtx(uint dwFlags, uint lpCookie);
[DllImport("Kernel32.dll", SetLastError = true)]
private extern static bool ReleaseActCtx(IntPtr hActCtx);
[DllImport("kernel32.dll")]
static extern uint FormatMessage(uint dwFlags, IntPtr lpSource,
uint dwMessageId, uint dwLanguageId, [Out] StringBuilder lpBuffer,
uint nSize, IntPtr Arguments);
[DllImport("Kernel32.dll", SetLastError = true)]
static extern uint FormatMessage(uint dwFlags, IntPtr lpSource,
uint dwMessageId, uint dwLanguageId, ref IntPtr lpBuffer,
uint nSize, IntPtr pArguments);
[DllImport("Kernel32.dll", SetLastError = true)]
static extern uint FormatMessage(uint dwFlags, IntPtr lpSource,
uint dwMessageId, uint dwLanguageId, ref IntPtr lpBuffer,
uint nSize, string[] Arguments);
[DllImport("kernel32.dll", SetLastError = true)]
static extern IntPtr LocalFree(IntPtr hMem);
[StructLayout(LayoutKind.Sequential)]
private struct ACTCTX
{
public int cbSize;
public uint dwFlags;
public string lpSource;
public ushort wProcessorArchitecture;
public ushort wLangId;
public string lpAssemblyDirectory;
public UInt16 lpResourceName;
public string lpApplicationName;
}
private const uint ACTCTX_FLAG_PROCESSOR_ARCHITECTURE_VALID = 0x001;
private const uint ACTCTX_FLAG_LANGID_VALID = 0x002;
private const uint ACTCTX_FLAG_ASSEMBLY_DIRECTORY_VALID = 0x004;
private const uint ACTCTX_FLAG_RESOURCE_NAME_VALID = 0x008;
private const uint ACTCTX_FLAG_SET_PROCESS_DEFAULT = 0x010;
private const uint ACTCTX_FLAG_APPLICATION_NAME_VALID = 0x020;
private const uint ACTCTX_FLAG_HMODULE_VALID = 0x080;
private const UInt16 RT_MANIFEST = 24;
private const UInt16 CREATEPROCESS_MANIFEST_RESOURCE_ID = 1;
private const UInt16 ISOLATIONAWARE_MANIFEST_RESOURCE_ID = 2;
private const UInt16 ISOLATIONAWARE_NOSTATICIMPORT_MANIFEST_RESOURCE_ID = 3;
private const uint FORMAT_MESSAGE_ALLOCATE_BUFFER = 0x00000100;
private const uint FORMAT_MESSAGE_IGNORE_INSERTS = 0x00000200;
private const uint FORMAT_MESSAGE_FROM_SYSTEM = 0x00001000;
////////////////////////////////////////////////////////////
private uint cookie = 0;
private static ACTCTX actCtx;
private static IntPtr hActCtx = IntPtr.Zero;
private static bool contextCreationSucceeded = false;
public bool EnterActCtx()
{
if (!contextCreationSucceeded || cookie != 0)
return false;
return ActivateActCtx(hActCtx, out cookie);
}
public bool ExitActCtx()
{
if (cookie == 0)
return false;
bool bRet = false;
try
{
bRet = DeactivateActCtx(0, cookie);
cookie = 0;
}
catch (Exception Ex)
{
System.Diagnostics.Debug.Print(Ex.ToString());
PrintError(Marshal.GetLastWin32Error());
}
return bRet;
}
public CActivationContextState()
{
if (EnsureActivateContextCreated())
{
if (!EnterActCtx())
{
// Be sure cookie always zero if activation failed
cookie = 0;
}
}
}
~CActivationContextState()
{
ExitActCtx();
if (contextCreationSucceeded)
{
ReleaseActCtx(hActCtx);
}
}
private void PrintError(int Error)
{
IntPtr lpMsgBuf = IntPtr.Zero;
uint dwChars = FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
IntPtr.Zero,
(uint)Error,
0, // Default language
ref lpMsgBuf,
0,
IntPtr.Zero);
if (dwChars == 0)
{
// Handle the error.
int le = Marshal.GetLastWin32Error();
}
string sRet = Marshal.PtrToStringAnsi(lpMsgBuf);
// Free the buffer.
lpMsgBuf = LocalFree(lpMsgBuf);
System.Diagnostics.Debug.Print(sRet);
}
private bool EnsureActivateContextCreated()
{
try
{
string rgchFullModulePath = null;
rgchFullModulePath = System.Reflection.Assembly.GetExecutingAssembly().Location;
actCtx = new ACTCTX();
actCtx.cbSize = Marshal.SizeOf(typeof(ACTCTX));
actCtx.dwFlags = ACTCTX_FLAG_RESOURCE_NAME_VALID;
actCtx.lpSource = rgchFullModulePath;
actCtx.lpResourceName = ISOLATIONAWARE_MANIFEST_RESOURCE_ID;
hActCtx = CreateActCtx(ref actCtx);
contextCreationSucceeded = (hActCtx != new IntPtr(-1));
if (!contextCreationSucceeded)
{
PrintError(Marshal.GetLastWin32Error());
actCtx.lpResourceName = ISOLATIONAWARE_NOSTATICIMPORT_MANIFEST_RESOURCE_ID;
hActCtx = CreateActCtx(ref actCtx);
contextCreationSucceeded = (hActCtx != new IntPtr(-1));
}
if (!contextCreationSucceeded)
{
PrintError(Marshal.GetLastWin32Error());
actCtx.lpResourceName = CREATEPROCESS_MANIFEST_RESOURCE_ID;
hActCtx = CreateActCtx(ref actCtx);
contextCreationSucceeded = (hActCtx != new IntPtr(-1));
}
}
catch (Exception Ex)
{
System.Diagnostics.Debug.Print(Ex.ToString());
}
return contextCreationSucceeded;
}
};
[System.ComponentModel.DesignTimeVisibleAttribute(true)]
[System.ComponentModel.ToolboxItemAttribute(true)]
public class AxMyScene : System.Windows.Forms.AxHost
{
// this will enter the actctx
private CActivationContextState ActCtxState = new CActivationContextState();
private System.Windows.Forms.AxHost.ConnectionPointCookie cookie;
public AxMyScene() :
base("77dbba22-ecfc-4c1f-90d2-b081a61c5ebd")
{
ActCtxState.ExitActCtx();
}
protected override object CreateInstanceCore(Guid clsid)
{
Object RetObject = null;
try
{
ActCtxState.EnterActCtx();
RetObject = base.CreateInstanceCore(clsid);
}
catch (Exception Ex1)
{
}
finally
{
try
{
ActCtxState.ExitActCtx();
}
catch (Exception Ex)
{
}
}
return RetObject;
}
// ...
}
***********************************************************************
2048-bit root upgrade completed for SSL
***********************************************************************
Dear customer,
On October 10, 2010, at 0600 PDT, VeriSign Identity and Authentication Security,
now a Division of Symantec, completed the upgrade to the 2048-bit VeriSign
Class 3 Public Primary Root Certification Authority-G5?, creating a stronger,
chained CA hierarchy for all our SSL and Code Signing Certificates.
All new SSL and Code Signing certificates are NOW being issued from inter-
mediate CAs under this 2048-bit root.
"$(SolutionDir)RTMBroker\bin\mt" /nologo -manifest "$(TargetPath).manifest" -outputresource:"$(TargetPath)";2
echo call "$(SolutionDir)RTMBroker\MakeDLLIntoAssembly" "$(SolutionDir)RTMBroker" "$(TargetDir)" $(TargetName) "$(TargetFileName)" VTX.tlb 3.0.0.91 fbf3841e0e84639c AJTSystems >> "$(SolutionDir)RTMBroker\FusionizeBuild.bat"
echo del /F "$(TargetPath)" >> "$(SolutionDir)RTMBroker\DeleteBuildProducts.bat"
%1\bin\mt /nologo -rgs:..\RTM.rgs -tlb:%5 -dll:%4 -identity:"%3, processorArchitecture=x86, version=%6, type=win32, publicKeyToken=%7" -out:%4.sxs.manifest
void AFX_MODULE_STATE::CreateActivationContext()
{
_AfxInitContextAPI();
HMODULE hModule = m_hCurrentInstanceHandle;
WCHAR rgchFullModulePath[MAX_PATH + 2];
rgchFullModulePath[_countof(rgchFullModulePath) - 1] = 0;
rgchFullModulePath[_countof(rgchFullModulePath) - 2] = 0;
DWORD dw = GetModuleFileNameW(hModule, rgchFullModulePath, _countof(rgchFullModulePath)-1);
if (dw == 0)
{
return;
}
if (rgchFullModulePath[_countof(rgchFullModulePath) - 2] != 0)
{
SetLastError(ERROR_BUFFER_OVERFLOW);
return;
}
//First try ID 2 and then ID 1 - this is to consider also a.dll.manifest file
//for dlls, which ID 2 ignores.
ACTCTXW actCtx;
actCtx.cbSize = sizeof(actCtx);
actCtx.dwFlags = ACTCTX_FLAG_RESOURCE_NAME_VALID | ACTCTX_FLAG_HMODULE_VALID;
actCtx.lpSource = rgchFullModulePath;
actCtx.lpResourceName = MAKEINTRESOURCEW(ISOLATIONAWARE_MANIFEST_RESOURCE_ID);
actCtx.hModule = hModule;
m_hActCtx = AfxCreateActCtxW(&actCtx);
if (m_hActCtx == INVALID_HANDLE_VALUE)
{
actCtx.lpResourceName = MAKEINTRESOURCEW(ISOLATIONAWARE_NOSTATICIMPORT_MANIFEST_RESOURCE_ID);
m_hActCtx = AfxCreateActCtxW(&actCtx);
}
if (m_hActCtx == INVALID_HANDLE_VALUE)
{
actCtx.lpResourceName = MAKEINTRESOURCEW(CREATEPROCESS_MANIFEST_RESOURCE_ID);
m_hActCtx = AfxCreateActCtxW(&actCtx);
}
if (m_hActCtx == INVALID_HANDLE_VALUE)
{
m_hActCtx = NULL;
}
}
STDMETHODIMP CVxMesh3D::LoadMesh(BSTR filename)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState())
HRESULT hr=S_OK;
hr=GetMesh3DObject()->LoadMesh(filename);
return hr;
}
AFX_MAINTAIN_STATE2::AFX_MAINTAIN_STATE2(AFX_MODULE_STATE* pNewState) throw()
{
#ifdef _AFXDLL
m_pThreadState = _afxThreadState.GetData();
ASSERT(m_pThreadState);
if(m_pThreadState)
{
m_pPrevModuleState = m_pThreadState->m_pModuleState;
m_pThreadState->m_pModuleState = pNewState;
}
else
{
// This is a very bad state; we have no good way to report the error at this moment
// since exceptions from here are not expected
m_pPrevModuleState=NULL;
m_pThreadState=NULL;
}
#endif
if (AfxGetAmbientActCtx() &&
pNewState->m_hActCtx != INVALID_HANDLE_VALUE)
{
m_bValidActCtxCookie = AfxActivateActCtx(pNewState->m_hActCtx, &m_ulActCtxCookie);
}
else
{
m_bValidActCtxCookie = FALSE;
}
}
// AFX_MAINTAIN_STATE2 functions
_AFXWIN_INLINE AFX_MAINTAIN_STATE2::~AFX_MAINTAIN_STATE2()
{
#ifdef _AFXDLL
// Not a good place to report errors here, so just be safe
if(m_pThreadState)
{
m_pThreadState->m_pModuleState = m_pPrevModuleState;
}
#endif
if (m_bValidActCtxCookie)
{
BOOL bRet;
bRet = AfxDeactivateActCtx(0, m_ulActCtxCookie);
ASSERT(bRet == TRUE);
}
}
By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.
Participate in the game development conversation and more when you create an account on GameDev.net!
Sign me up!