mirror of https://github.com/lianthony/NT4.0
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
905 B
35 lines
905 B
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#include <windows.h>
|
|
#include <lmcons.h>
|
|
#include <lmerr.h>
|
|
#include <apperr2.h>
|
|
#include <upsfunc.h>
|
|
|
|
#define IS_ARG(c) (((c) == '-') || ((c) == '/'))
|
|
#define ERRFILE L"NETMSG"
|
|
#define ERRNUM APE2_UPS_POWER_OUT
|
|
|
|
void _CRTAPI1 main(int, char**);
|
|
|
|
void _CRTAPI1 main(int argc, char** argv) {
|
|
|
|
HANDLE hModule;
|
|
NET_API_STATUS status;
|
|
TCHAR cname[80];
|
|
DWORD nameLen = sizeof(cname);
|
|
|
|
hModule = LoadLibrary(ERRFILE);
|
|
if (!hModule) {
|
|
printf("can't load module %ws\n", ERRFILE);
|
|
exit(1);
|
|
}
|
|
GetComputerName(cname, &nameLen);
|
|
status = UpsNotifyUsers(ERRNUM,
|
|
hModule,
|
|
UPS_ACTION_PAUSE_SERVER | UPS_ACTION_SEND_MESSAGE,
|
|
cname
|
|
);
|
|
printf("UpsNotifyUsers returns %u\n", status);
|
|
}
|