本文整理汇总了C++中IsWinNT函数的典型用法代码示例。如果您正苦于以下问题:C++ IsWinNT函数的具体用法?C++ IsWinNT怎么用?C++ IsWinNT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IsWinNT函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetThreadDesktop
BOOL
vncService::SelectHDESK(HDESK new_desktop)
{
// Are we running on NT?
if (IsWinNT())
{
HDESK old_desktop = GetThreadDesktop(GetCurrentThreadId());
DWORD dummy;
char new_name[256];
if (!GetUserObjectInformation(new_desktop, UOI_NAME, &new_name, 256, &dummy)) {
vnclog.Print(LL_INTERR, VNCLOG("!GetUserObjectInformation \n"));
return FALSE;
}
vnclog.Print(LL_INTERR, VNCLOG("SelectHDESK to %s (%x) from %x\n"), new_name, new_desktop, old_desktop);
// Switch the desktop
if(!SetThreadDesktop(new_desktop)) {
vnclog.Print(LL_INTERR, VNCLOG("SelectHDESK:!SetThreadDesktop \n"));
return FALSE;
}
return TRUE;
}
return TRUE;
}
示例2: FileCopy
bool FileCopy(const char *oldname, const char *newname)
{
#if defined(PLATFORM_WIN32)
if(IsWinNT())
return UnicodeWin32().CopyFileW(ToSystemCharsetW(oldname), ToSystemCharsetW(newname), false);
else
return CopyFile(ToSystemCharset(oldname), ToSystemCharset(newname), false);
#elif defined(PLATFORM_POSIX)
FileIn fi(oldname);
if(!fi.IsOpen())
return false;
FileOut fo(newname);
if(!fo.IsOpen())
return false;
CopyStream(fo, fi, fi.GetLeft());
fi.Close();
fo.Close();
if(fo.IsError())
{
unlink(newname);
return false;
}
FileSetTime(newname, FileGetTime(oldname));
return true;
#else
#error
#endif//PLATFORM
}
示例3: DirectoryCreate
bool DirectoryCreate(const char *path)
{
if(IsWinNT())
return !!UnicodeWin32().CreateDirectoryW(ToSystemCharsetW(path), 0);
else
return !!CreateDirectory(ToSystemCharset(path), 0);
}
示例4: GetThreadDesktop
BOOL
vncService::SelectHDESK(HDESK new_desktop)
{
// Are we running on NT?
if (IsWinNT())
{
HDESK old_desktop = GetThreadDesktop(GetCurrentThreadId());
//You do not need to call the CloseDesktop function to close the returned handle.
DWORD dummy;
char new_name[256];
if (!GetUserObjectInformation(new_desktop, UOI_NAME, &new_name, 256, &dummy)) {
return FALSE;
}
//vnclog.Print(LL_INTERR, VNCLOG("SelectHDESK to %s (%x) from %x\n"), new_name, new_desktop, old_desktop);
// Switch the desktop
if(!SetThreadDesktop(new_desktop))
{
return FALSE;
}
return TRUE;
}
return TRUE;
}
示例5: SetFileTime
bool SetFileTime(const char *filename, FileTime ft)
{
#if defined(PLATFORM_WIN32)
HANDLE handle;
if(IsWinNT())
handle = UnicodeWin32().CreateFileW(ToSystemCharsetW(filename), GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
OPEN_EXISTING, 0, NULL);
else
handle = CreateFile(ToSystemCharset(filename), GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
OPEN_EXISTING, 0, NULL);
if(handle == INVALID_HANDLE_VALUE)
return false;
bool res = SetFileTime(handle, 0, 0, &ft);
CloseHandle(handle);
return res;
#elif defined(PLATFORM_POSIX)
struct utimbuf ub;
ub.actime = ub.modtime = ft;
return !utime(ToSystemCharset(filename), &ub);
#else
#error
#endif//PLATFORM
}
示例6: DelayCopy
BOOL DelayCopy(char *src, char *dst)
{
char tmp_file[MAX_PATH];
BOOL ret = FALSE;
wsprintf(tmp_file, "%s.new", dst);
if (MiniCopy(src, tmp_file) == FALSE)
return FALSE;
if (IsWinNT()) {
ret = ::MoveFileEx(tmp_file, dst, MOVEFILE_DELAY_UNTIL_REBOOT|MOVEFILE_REPLACE_EXISTING);
}
else {
char win_ini[MAX_PATH], short_tmp[MAX_PATH], short_dst[MAX_PATH];
::GetShortPathName(tmp_file, short_tmp, sizeof(short_tmp));
::GetShortPathName(dst, short_dst, sizeof(short_dst));
::GetWindowsDirectory(win_ini, sizeof(win_ini));
strcat(win_ini, "\\WININIT.INI");
// WritePrivateProfileString("Rename", "NUL", short_dst, win_ini); 必要なさそ
ret = WritePrivateProfileString("Rename", short_dst, short_tmp, win_ini);
}
return ret;
}
示例7: ReadSystemEnv
/*
* ReadSystemEnv() -- read system environment variable
*/
BOOL ReadSystemEnv(char **ppszEnvValue, char *pszEnvName)
{
if (IsWinNT())
return ReadRegEnv(ppszEnvValue, pszEnvName);
else
return ReadAutoExec(ppszEnvValue, pszEnvName);
}
示例8: GetFileTime
FileTime GetFileTime(const char *filename)
{
#if defined(PLATFORM_WIN32)
HANDLE handle;
if(IsWinNT())
handle = UnicodeWin32().CreateFileW(ToSystemCharsetW(filename), GENERIC_READ,
FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
else
handle = CreateFile(ToSystemCharset(filename), GENERIC_READ,
FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
FileTime ft0;
memset(&ft0, 0, sizeof(ft0));
if(handle == INVALID_HANDLE_VALUE)
return ft0;
FileTime ft;
bool res = GetFileTime(handle, 0, 0, &ft);
CloseHandle(handle);
return res ? ft : ft0;
#elif defined(PLATFORM_POSIX)
struct stat st;
if(stat(ToSystemCharset(filename), &st))
return 0;
return st.st_mtime;
#else
#error
#endif//PLATFORM
}
示例9: _ASSERTE
BOOL vncVideoDriver::TestMapped()
{
_ASSERTE(IsWinNT());
TCHAR *pDevName;
if (IsWinVerOrHigher(5, 0))
{
DISPLAY_DEVICE dd;
INT devNum = 0;
if (!LookupVideoDeviceAlt(szDriverString, szDriverStringAlt, devNum, &dd))
return FALSE;
pDevName = (TCHAR *)dd.DeviceName;
}
else
{
pDevName = "DISPLAY";
}
HDC l_ddc = ::CreateDC(pDevName, NULL, NULL, NULL);
if (l_ddc)
{
BOOL b = ExtEscape(l_ddc, TESTMAPPED, 0, NULL, 0, NULL);
DeleteDC(l_ddc);
return b;
}
return FALSE;
}
示例10: WriteSystemEnv
/*
* WriteSystemEnv() -- write system environment variable
*/
BOOL WriteSystemEnv(char *pszEnvValue, char *pszEnvName)
{
if (IsWinNT())
return WriteRegEnv(pszEnvValue, pszEnvName);
else
return WriteAutoExec(pszEnvValue, pszEnvName);
}
示例11: GetThreadDesktop
BOOL
vncService::SelectHDESK(HDESK new_desktop)
{
// Are we running on NT?
if (IsWinNT())
{
HDESK old_desktop = GetThreadDesktop(GetCurrentThreadId());
DWORD dummy;
char new_name[256];
if (!GetUserObjectInformation(new_desktop, UOI_NAME, &new_name, 256, &dummy)) {
return FALSE;
}
// Switch the desktop
if(!SetThreadDesktop(new_desktop)) {
return FALSE;
}
// Switched successfully - destroy the old desktop
CloseDesktop(old_desktop);
return TRUE;
}
return TRUE;
}
示例12: VNCLOG
BOOL
vncService::SimulateCtrlAltDel()
{
vnclog.Print(LL_ALL, VNCLOG("preparing to generate ctrl-alt-del\n"));
// Are we running on NT?
if (IsWinNT())
{
vnclog.Print(LL_ALL, VNCLOG("spawn ctrl-alt-del thread...\n"));
// We simulate Ctrl+Alt+Del by posting a WM_HOTKEY message to the
// "SAS window" on the Winlogon desktop.
// This requires that the current thread is part of the Winlogon desktop.
// But the current thread has hooks set & a window open, so it can't
// switch desktops, so I instead spawn a new thread & let that do the work...
omni_thread *thread = omni_thread::create(SimulateCtrlAltDelThreadFn);
if (thread == NULL)
return FALSE;
thread->join(NULL);
return TRUE;
}
return TRUE;
}
示例13: GetThreadDesktop
BOOL
vncService::SelectHDESK(HDESK new_desktop)
{
// Are we running on NT?
if (IsWinNT())
{
HDESK old_desktop = GetThreadDesktop(GetCurrentThreadId());
DWORD dummy;
char new_name[256];
if (!GetUserObjectInformation(new_desktop, UOI_NAME, &new_name, 256, &dummy)) {
vnclog.Print(LL_INTERR, VNCLOG("GetUserObjectInformation() failed\n"));
return FALSE;
}
vnclog.Print(LL_INTINFO, VNCLOG("SelectHDESK() to %s (%x) from %x\n"),
new_name, new_desktop, old_desktop);
// Switch the desktop
if(!SetThreadDesktop(new_desktop)) {
vnclog.Print(LL_INTERR, VNCLOG("unable to SetThreadDesktop(), error=%d\n"), GetLastError());
return FALSE;
}
// Switched successfully - destroy the old desktop
if (!CloseDesktop(old_desktop))
vnclog.Print(LL_INTERR, VNCLOG("SelectHDESK failed to close old desktop %x, error=%d\n"), old_desktop, GetLastError());
return TRUE;
}
return TRUE;
}
示例14: VNCLOG
// - SelectDesktop(char *)
// Switches the current thread into a different desktop, by name
// Calling with a valid desktop name will place the thread in that desktop.
// Calling with a NULL name will place the thread in the current input desktop.
BOOL
vncService::SelectDesktop(char *name, HDESK *new_desktop)
{
//return false;
// Are we running on NT?
if (IsWinNT())
{
HDESK desktop;
vnclog.Print(LL_INTERR, VNCLOG("SelectDesktop \n"));
if (name != NULL)
{
vnclog.Print(LL_INTERR, VNCLOG("OpenInputdesktop2 named\n"));
// Attempt to open the named desktop
desktop = OpenDesktop(name, 0, FALSE,
DESKTOP_CREATEMENU | DESKTOP_CREATEWINDOW |
DESKTOP_ENUMERATE | DESKTOP_HOOKCONTROL |
DESKTOP_WRITEOBJECTS | DESKTOP_READOBJECTS |
DESKTOP_SWITCHDESKTOP | GENERIC_WRITE);
}
else
{
vnclog.Print(LL_INTERR, VNCLOG("OpenInputdesktop2 NULL\n"));
// No, so open the input desktop
desktop = OpenInputDesktop(0, FALSE,
DESKTOP_CREATEMENU | DESKTOP_CREATEWINDOW |
DESKTOP_ENUMERATE | DESKTOP_HOOKCONTROL |
DESKTOP_WRITEOBJECTS | DESKTOP_READOBJECTS |
DESKTOP_SWITCHDESKTOP | GENERIC_WRITE);
}
// Did we succeed?
if (desktop == NULL) {
vnclog.Print(LL_INTERR, VNCLOG("OpenInputdesktop2 \n"));
return FALSE;
}
else vnclog.Print(LL_INTERR, VNCLOG("OpenInputdesktop2 OK\n"));
// Switch to the new desktop
if (!SelectHDESK(desktop)) {
// Failed to enter the new desktop, so free it!
if (!CloseDesktop(desktop))
vnclog.Print(LL_INTERR, VNCLOG("SelectDesktop failed to close desktop\n"));
return FALSE;
}
if (new_desktop)
{
if (*new_desktop)
CloseDesktop(*new_desktop);
*new_desktop = desktop;
}
// We successfully switched desktops!
return TRUE;
}
return (name == NULL);
}
示例15: unmap_phys_mem
void unmap_phys_mem(void *ptr, unsigned long size) {
if(IsWinNT()){
dhahelper_t dhahelper_priv;
DWORD dwBytesReturned;
dhahelper_priv.ptr = ptr;
DeviceIoControl(hDriver, IOCTL_DHAHELPER_UNMAPPHYSADDR, &dhahelper_priv,sizeof(dhahelper_t), NULL, 0, &dwBytesReturned, NULL);
}
}