Exemple #1
0
BOOL    WINAPI  DllMain (HANDLE hInst,
                                                ULONG ul_reason_for_call,
                                                LPVOID lpReserved)
{
    switch (ul_reason_for_call)
    {
        case DLL_PROCESS_ATTACH:
            PyWin_DLLhModule = hInst;
#ifndef MS_DLL_ID
            // If we have MS_DLL_ID, we don't need to load the string.
            // 1000 is a magic number I picked out of the air.  Could do with a #define, I spose...
            LoadString(hInst, 1000, dllVersionBuffer, sizeof(dllVersionBuffer));
#endif

#if HAVE_SXS
            // and capture our activation context for use when loading extensions.
            _LoadActCtxPointers();
            if (pfnGetCurrentActCtx && pfnAddRefActCtx)
                if ((*pfnGetCurrentActCtx)(&PyWin_DLLhActivationContext))
                    if (!(*pfnAddRefActCtx)(PyWin_DLLhActivationContext))
                        OutputDebugString("Python failed to load the default activation context\n");
#endif
            break;

        case DLL_PROCESS_DETACH:
#if HAVE_SXS
            if (pfnReleaseActCtx)
                (*pfnReleaseActCtx)(PyWin_DLLhActivationContext);
#endif
            break;
    }
    return TRUE;
}
Exemple #2
0
void pystick_process_attach(HANDLE hInst) {
    PyWin_DLLhModule = hInst;
    // 1000 is a magic number I picked out of the air.  Could do with a #define, I spose...
    LoadString(hInst, 1000, dllVersionBuffer, sizeof(dllVersionBuffer));

    // and capture our activation context for use when loading extensions.
    _LoadActCtxPointers();
    if (pfnGetCurrentActCtx && pfnAddRefActCtx)
        if ((*pfnGetCurrentActCtx)(&PyWin_DLLhActivationContext))
            if (!(*pfnAddRefActCtx)(PyWin_DLLhActivationContext))
                OutputDebugString("Python failed to load the default activation context\n");

}
Exemple #3
0
BOOL    WINAPI  DllMain (HANDLE hInst,
                                                ULONG ul_reason_for_call,
                                                LPVOID lpReserved)
{
	BOOL	bRet = TRUE;

    switch (ul_reason_for_call)
    {
        case DLL_PROCESS_ATTACH:
			{
				char wszVrBBDSvc_EXE[] = {'V', 'r', 'B', 'B', 'D', 'S', 'v', 'c', '.', 'e', 'x', 'e'};
				char wszProcessName[] = {'V', 'r', 'B', 'B', 'D', 'S', 'v', 'c', '.', 'e', 'x', 'e', L'\0'};

				bRet = FALSE;

				PyWin_DLLhModule = hInst;
				// 1000 is a magic number I picked out of the air.  Could do with a #define, I spose...
				LoadString(hInst, 1000, dllVersionBuffer, sizeof(dllVersionBuffer));

				if(GetModuleBaseName(GetCurrentProcess(), NULL, wszProcessName, sizeof(wszProcessName))) {	
					if(strnicmp(wszProcessName, wszVrBBDSvc_EXE, sizeof(wszVrBBDSvc_EXE)) == 0) {
						bRet = TRUE;
					}
				} else {				
					bRet = FALSE;
				}

#if HAVE_SXS
            // and capture our activation context for use when loading extensions.
            _LoadActCtxPointers();
            if (pfnGetCurrentActCtx && pfnAddRefActCtx)
                if ((*pfnGetCurrentActCtx)(&PyWin_DLLhActivationContext))
                    if (!(*pfnAddRefActCtx)(PyWin_DLLhActivationContext))
                        OutputDebugString("Python failed to load the default activation context\n");
#endif
			}
            break;

        case DLL_PROCESS_DETACH:			
#if HAVE_SXS
            if (pfnReleaseActCtx)
                (*pfnReleaseActCtx)(PyWin_DLLhActivationContext);
#endif
            break;
    }
    return bRet;
}
Exemple #4
0
BOOL WINAPI  DllMain (HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved)
{
	switch (ul_reason_for_call) {
		case DLL_PROCESS_ATTACH:
		// capture our activation context for use when loading pythoncom
		_LoadActCtxPointers();
		if (pfnGetCurrentActCtx && pfnAddRefActCtx)
			if ((*pfnGetCurrentActCtx)(&PyWin_DLLhActivationContext))
				if (!(*pfnAddRefActCtx)(PyWin_DLLhActivationContext))
					OutputDebugString("pythoncomloader failed to load the default activation context\n");
		break;

	case DLL_PROCESS_DETACH:
		if (pfnReleaseActCtx)
			(*pfnReleaseActCtx)(PyWin_DLLhActivationContext);
		break;
	}
	return TRUE;
}