Организация удаленного доступа к распределенным базам данных
nfigWatchingThread;
extern HANDLE hConfigMutex;
extern HANDLE hTaskMutex;
extern unsigned char *pszProtocolSequence;
extern unsigned char *pszSecurity;
extern unsigned char *pszEndpoint;
extern unsigned int cMinCalls;
extern unsigned int cMaxCalls;
extern unsigned int fDontWait;
extern struct TASKENTRY TaskTable[TASK_COUNT];
extern int EntryCount;
extern DWORD TaskThreads[TASK_COUNT];
extern int TaskCount;
DWORD WINAPI CommonConfigWatcher(LPVOID ThreadParm);
void UpdateVariables();
#endif
EventLog.h
#ifndef __EVENT_LOG
#define __EVENT_LOG
void LogEvent(WORD EventType, LPSTR EventMsg);
#endif
ClientHandler.h
#ifndef __CLIENT_HANDLER
#define __CLIENT_HANDLER
extern DWORD ClientHandlingThread;
DWORD WINAPI RPCClientHandling(LPVOID ThreadParm);
void RefreshIniProps();
#endif
ShedulerServ.h
#ifndef __SHEDULING_SERVICE
#define __SHEDULING_SERVICE
#define TaskProcName "TaskProc"
extern BOOL TerminateSheduling;
extern DWORD ShedulingThread;
DWORD WINAPI ShedulingProc(LPVOID ThreadParm);
void TerminateTasks();
#endif
RegistryConfig.h
#ifndef __REGISTRY_CONFIG
#define __REGISTRY_CONFIG
#define REGISTRY_TASKS_PATH "SOFTWARESvyazinformCommServiceTasks"
struct TASKENTRY
{
DWORD ExecTime;
char DllName[256];
FARPROC TermProc;
DWORD TaskThread;
BOOL Active;
};
#endif
Comm.idl
/* IDL File */
[ uuid (4a25d2e0-6703-11d0-8927-00a02413850e),
version(1.0)
]
interface CommService
{
void RefreshIniProps();
}
Comm.acf
/* acf file for TimeInclude Service (RPC) */
[ implicit_handle(handle_t CommServ_IfHandle)
]interface CommService
{
}
Приложение 4
Исходные тексты программы установки коммуникационного сервиса
#include
#include
void RegEventSource();
VOID _CRTAPI1 main(void)
{
LPCTSTR lpszBinaryPathName =
TEXT("c:ibserverbinCommServ.exe");
SC_HANDLE schSCManager;
SC_HANDLE schService;
/* Open a handle to the SC Manager database. */
schSCManager = OpenSCManager(
NULL, /* local machine */
NULL, /* ServicesActive database */
SC_MANAGER_ALL_ACCESS); /* full access rights */
if (schSCManager == NULL) {
printf("nError opening Service Manager.n");
return;
}
schService = CreateService(
schSCManager, /* SCManager database */
TEXT("CommServ"), /* name of service */
TEXT("JSC "SvjazInform" Communication Service"), /*
service name to display */
SERVICE_ALL_ACCESS, /* desired access */
SERVICE_WIN32_OWN_PROCESS, /* service type */
SERVICE_DEMAND_START, /* start type */
SERVICE_ERROR_NORMAL, /* error control type */
lpszBinaryPathName, /* service's binary */
NULL, /* no load ordering group */
NULL, /* no tag identifier */
NULL, /* no dependencies */
NULL, /* LocalSystem account */
NULL); /* no password */
if (schService == NULL) {
printf("nFailed to create service!n");
}
else
printf("CreateService SUCCESSn");
CloseServiceHandle(schService);
CloseServiceHandle(schSCManager);
RegEventSource();
}
void RegEventSource()
{
HKEY hk;
DWORD dwData;
UCHAR szBuf[80];
if (RegCreateKey(HKEY_LOCAL_MACHINE,
"SYSTEMCurrentControlSetServices
EventLogApplicationCommServ", &hk)) {
printf("could not create registry key");
return;
}
/* Set the Event ID message-file name. */
strcpy(szBuf, "c:ibserverbinCommServ.exe");
/* Add the Event ID message-file name to the subkey. */
if (RegSetValueEx(hk, /* subkey handle */
"EventMessageFile", /* value name */
0, /* must be zero */
REG_EXPAND_SZ, /* value type */
(LPBYTE) szBuf, /* address of value data */
strlen(szBuf) + 1)) /* length of value data*/
{
printf("could not set event message file");
return;
}
/* Set the supported types flags. */
dwData = EVENTLOG_ERROR_TYPE | EVENTLOG_WARNING_TYPE |
EVENTLOG_INFORMATION_TYPE;
if (RegSetValueEx(hk, /* subkey handle */
"TypesSupported", /* value name */
0, /* must be zero */
REG_DWORD, /* value type */
(LPBYTE) &dwData, /* address of value data*/
sizeof(DWORD))) /* length of value data */
{
printf("could not set supported types");
return;
}
RegCloseKey(hk);
}
Приложение 5
Исходные тексты программы удаления коммуникационного сервиса
#include
#include
void CleanRegistry();
VOID _CRTAPI1 main(void)
{
SC_HANDLE schSCManager;
SC_HANDLE schService;
/* Open a handle to the SC Manager database. */
schSCManager = OpenSCManager(
NULL, /* local machine */
NULL, /* ServicesActive database */
SC_MANAGER_ALL_ACCESS); /* full access rights */
if (schSCManager == NULL) {
printf("nError opening Service Manager.n");
return;
}
schService = OpenService(
schSCManager, /* SCManager database */
TEXT("CommServ"), /* name of service */
DELETE); /* only need DELETE access */
if (! DeleteService(schService) )
printf("nFailed to Delete service!n");
else
printf("DeleteService SUCCESSn");
CloseServiceHandle(schService);
CloseServiceHandle(schSCManager);
}
void CleanRegistry()
{
if (RegDeleteKey(HKEY_LOCAL_MACHINE,
"SYSTEMCurrentControlSetServices
EventLogApplicationCommServ"))
{
printf("nError Cleaning Registry");
} else {
printf("nCleaning Registry SUCCESS");
}
return;
}
Приложение 6
Структуры баз данных
| | скачать работу |
Организация удаленного доступа к распределенным базам данных |