Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
pifmgr.c
Package: shell.rar [view]
Upload User: xhy777
Upload Date: 2007-02-14
Package Size: 24088k
Code Size: 4k
Category:
Windows Kernel
Development Platform:
Visual C++
- //
- // Thunks for calling PIFMGR.DLL from Shell32.dll
- //
- // PifMgr_OpenProperties
- // PifMgr_CloseProperties
- // PifMgr_GetProperties
- // PifMgr_SetProperties
- //
- // PIFMGR.DLL will be kept loaded as long as a PIF PROPERTIES handle is open
- // and will be free'ed (via FreeLibrary) when the last handle is closed.
- //
- #include "shprv.h"
- #include <pif.h>
- static HMODULE hPifMgrDll;
- static UINT cRef;
- static int (WINAPI *XOpenProperties)(LPCSTR lpszApp, LPCSTR lpszPIF, int hInf, int flOpt);
- static int (WINAPI *XGetProperties)(int hProps, LPCSTR lpszGroup, LPVOID lpProps, int cbProps, int flOpt);
- static int (WINAPI *XSetProperties)(int hProps, LPCSTR lpszGroup, const VOID FAR *lpProps, int cbProps, int flOpt);
- static int (WINAPI *XCloseProperties)(int hProps, int flOpt);
- static char szPifMgrDll[] = "PIFMGR.DLL";
- /*****************************************************************************
- ****************************************************************************/
- BOOL PifMgr_Load()
- {
- if (hPifMgrDll == NULL)
- {
- DebugMsg(DM_TRACE, "pif: Loading PIFMGR.DLL");
- hPifMgrDll = LoadLibrary(szPifMgrDll);
- if (hPifMgrDll <= HINSTANCE_ERROR)
- {
- hPifMgrDll = NULL;
- return FALSE;
- }
- (FARPROC)XOpenProperties = GetProcAddress(hPifMgrDll, MAKEINTATOM(ORD_OPENPROPERTIES));
- (FARPROC)XCloseProperties = GetProcAddress(hPifMgrDll, MAKEINTATOM(ORD_CLOSEPROPERTIES));
- (FARPROC)XGetProperties = GetProcAddress(hPifMgrDll, MAKEINTATOM(ORD_GETPROPERTIES));
- (FARPROC)XSetProperties = GetProcAddress(hPifMgrDll, MAKEINTATOM(ORD_SETPROPERTIES));
- }
- return TRUE;
- }
- /*****************************************************************************
- ****************************************************************************/
- void PifMgr_Free()
- {
- HMODULE h;
- if (cRef == 0 && (h=hPifMgrDll))
- {
- DebugMsg(DM_TRACE, "pif: Unloading PIFMGR.DLL");
- hPifMgrDll = NULL;
- FreeLibrary(h);
- XOpenProperties = NULL;
- XCloseProperties = NULL;
- XGetProperties = NULL;
- XSetProperties = NULL;
- }
- }
- /*****************************************************************************
- ****************************************************************************/
- int WINAPI PifMgr_OpenProperties(LPCSTR lpszApp, LPCSTR lpszPIF, int hInf, int flOpt)
- {
- int hpif=NULL;
- if (PifMgr_Load())
- {
- cRef++;
- hpif = XOpenProperties(lpszApp, lpszPIF, hInf, flOpt);
- if (hpif == NULL)
- cRef--;
- }
- return hpif;
- }
- /*****************************************************************************
- ****************************************************************************/
- int WINAPI PifMgr_GetProperties(int hProps, LPCSTR lpszGroup, LPVOID lpProps, int cbProps, int flOpt)
- {
- if (PifMgr_Load())
- return XGetProperties(hProps, lpszGroup, lpProps, cbProps, flOpt);
- else
- return 0;
- }
- /*****************************************************************************
- ****************************************************************************/
- int WINAPI PifMgr_SetProperties(int hProps, LPCSTR lpszGroup, const VOID FAR *lpProps, int cbProps, int flOpt)
- {
- if (PifMgr_Load())
- return XSetProperties(hProps, lpszGroup, lpProps, cbProps, flOpt);
- else
- return 0;
- }
- /*****************************************************************************
- ****************************************************************************/
- int WINAPI PifMgr_CloseProperties(int hProps, int flOpt)
- {
- int i;
- //
- // SHELL32.DLL calls this (with NULL) on thread detach to
- // give us a chance to free PIFMGR if we dont need it.
- //
- if (hProps == NULL)
- {
- PifMgr_Free();
- }
- else if (cRef > 0)
- {
- i = XCloseProperties(hProps, flOpt);
- cRef--;
- }
- return i;
- }