Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Return the relevant macro value
- switch (i)
- {
- case M_CR:
- vResult = "\r";
- break;
- case M_LF:
- vResult = "\n";
- break;
- case M_CRLF:
- vResult = "\r\n";
- break;
- case M_TAB:
- vResult = "\t";
- break;
- case M_ERROR:
- vResult = m_nFuncErrorCode; // Extended function error code
- break;
- case M_EXTENDED:
- vResult = m_nFuncExtCode; // Extended function code
- break;
- case M_SEC:
- sprintf(szValue, "%.2d", newtime->tm_sec);
- vResult = szValue;
- break;
- case M_MIN:
- sprintf(szValue, "%.2d", newtime->tm_min);
- vResult = szValue;
- break;
- case M_HOUR:
- sprintf(szValue, "%.2d", newtime->tm_hour);
- vResult = szValue;
- break;
- case M_MDAY:
- sprintf(szValue, "%.2d", newtime->tm_mday);
- vResult = szValue;
- break;
- case M_MON:
- sprintf(szValue, "%.2d", newtime->tm_mon + 1);
- vResult = szValue;
- break;
- case M_YEAR:
- vResult = int(newtime->tm_year + 1900);
- break;
- case M_WDAY:
- vResult = int(newtime->tm_wday + 1);
- break;
- case M_YDAY:
- sprintf(szValue, "%.3d", newtime->tm_yday);
- vResult = szValue;
- break;
- case M_PROGRAMFILESDIR:
- Util_RegReadString(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion", "ProgramFilesDir", _MAX_PATH, szValue);
- vResult = szValue;
- break;
- case M_COMMONFILESDIR:
- Util_RegReadString(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion", "CommonFilesDir", _MAX_PATH, szValue);
- vResult = szValue;
- break;
- case M_MYDOCUMENTSDIR:
- Util_RegReadString(HKEY_CURRENT_USER, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", "Personal", _MAX_PATH, szValue);
- Util_StripTrailingDir(szValue); // Remove trailing blackslash
- vResult = szValue;
- break;
- case M_APPDATACOMMONDIR:
- Util_RegReadString(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", "Common AppData", _MAX_PATH, szValue);
- vResult = szValue;
- break;
- case M_DESKTOPCOMMONDIR:
- Util_RegReadString(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", "Common Desktop", _MAX_PATH, szValue);
- if (szValue[0] == '\0')
- Util_RegReadString(HKEY_CURRENT_USER, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", "Desktop", _MAX_PATH, szValue);
- vResult = szValue;
- break;
- case M_DOCUMENTSCOMMONDIR:
- Util_RegReadString(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", "Common Documents", _MAX_PATH, szValue);
- vResult = szValue;
- break;
- case M_FAVORITESCOMMONDIR:
- Util_RegReadString(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", "Common Favorites", _MAX_PATH, szValue);
- if (szValue[0] == '\0')
- Util_RegReadString(HKEY_CURRENT_USER, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", "Favorites", _MAX_PATH, szValue);
- vResult = szValue;
- break;
- case M_PROGRAMSCOMMONDIR:
- Util_RegReadString(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", "Common Programs", _MAX_PATH, szValue);
- if (szValue[0] == '\0')
- Util_RegReadString(HKEY_CURRENT_USER, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", "Programs", _MAX_PATH, szValue);
- vResult = szValue;
- break;
- case M_STARTMENUCOMMONDIR:
- Util_RegReadString(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", "Common Start Menu", _MAX_PATH, szValue);
- if (szValue[0] == '\0')
- Util_RegReadString(HKEY_CURRENT_USER, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", "Start Menu", _MAX_PATH, szValue);
- vResult = szValue;
- break;
- case M_STARTUPCOMMONDIR:
- Util_RegReadString(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", "Common Startup", _MAX_PATH, szValue);
- if (szValue[0] == '\0')
- Util_RegReadString(HKEY_CURRENT_USER, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", "Startup", _MAX_PATH, szValue);
- vResult = szValue;
- break;
- case M_APPDATADIR:
- Util_RegReadString(HKEY_CURRENT_USER, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", "AppData", _MAX_PATH, szValue);
- vResult = szValue;
- break;
- case M_DESKTOPDIR:
- Util_RegReadString(HKEY_CURRENT_USER, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", "Desktop", _MAX_PATH, szValue);
- vResult = szValue;
- break;
- case M_FAVORITESDIR:
- Util_RegReadString(HKEY_CURRENT_USER, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", "Favorites", _MAX_PATH, szValue);
- vResult = szValue;
- break;
- case M_PROGRAMSDIR:
- Util_RegReadString(HKEY_CURRENT_USER, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", "Programs", _MAX_PATH, szValue);
- vResult = szValue;
- break;
- case M_STARTMENUDIR:
- Util_RegReadString(HKEY_CURRENT_USER, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", "Start Menu", _MAX_PATH, szValue);
- vResult = szValue;
- break;
- case M_STARTUPDIR:
- Util_RegReadString(HKEY_CURRENT_USER, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", "Startup", _MAX_PATH, szValue);
- vResult = szValue;
- break;
- case M_COMPUTERNAME:
- dwTemp = _MAX_PATH;
- GetComputerName(szValue, &dwTemp);
- vResult = szValue;
- break;
- case M_WINDOWSDIR:
- GetWindowsDirectory(szValue, _MAX_PATH);
- vResult = szValue;
- break;
- case M_SYSTEMDIR:
- GetSystemDirectory(szValue, _MAX_PATH);
- vResult = szValue;
- break;
- case M_SW_HIDE:
- vResult = SW_HIDE;
- break;
- case M_SW_MINIMIZE:
- vResult = SW_MINIMIZE;
- break;
- case M_SW_MAXIMIZE:
- vResult = SW_MAXIMIZE;
- break;
- case M_SW_RESTORE:
- vResult = SW_RESTORE;
- break;
- case M_SW_SHOW:
- vResult = SW_SHOW;
- break;
- case M_SW_SHOWDEFAULT:
- vResult = SW_SHOWDEFAULT;
- break;
- case M_SW_SHOWMAXIMIZED:
- vResult = SW_SHOWMAXIMIZED;
- break;
- case M_SW_SHOWMINIMIZED:
- vResult = SW_SHOWMINIMIZED;
- break;
- case M_SW_SHOWMINNOACTIVE:
- vResult = SW_SHOWMINNOACTIVE;
- break;
- case M_SW_SHOWNA:
- vResult = SW_SHOWNA;
- break;
- case M_SW_SHOWNOACTIVATE:
- vResult = SW_SHOWNOACTIVATE;
- break;
- case M_SW_SHOWNORMAL:
- vResult = SW_SHOWNORMAL;
- break;
- case M_SCRIPTFULLPATH:
- vResult = m_sScriptFullPath.c_str();
- break;
- case M_SCRIPTNAME:
- vResult = m_sScriptName.c_str();
- break;
- case M_SCRIPTDIR:
- vResult = m_sScriptDir.c_str();
- break;
- case M_WORKINGDIR:
- GetCurrentDirectory(_MAX_PATH, szValue);
- vResult = szValue;
- break;
- case M_OSTYPE:
- if ( g_oVersion.IsWinNT() == true )
- vResult = "WIN32_NT";
- else
- vResult = "WIN32_WINDOWS";
- break;
- case M_OSVERSION:
- if ( g_oVersion.IsWinNT() == true )
- {
- if (g_oVersion.IsWin2003() == true)
- vResult = "WIN_2003";
- else if (g_oVersion.IsWinXP() == true)
- vResult = "WIN_XP";
- else if (g_oVersion.IsWin2000() == true)
- vResult = "WIN_2000";
- else
- vResult = "WIN_NT4";
- }
- else
- {
- if (g_oVersion.IsWin95() == true)
- vResult = "WIN_95";
- else if (g_oVersion.IsWin98() == true)
- vResult = "WIN_98";
- else
- vResult = "WIN_ME";
- } // End If
- break;
- case M_OSBUILD:
- vResult = (int)g_oVersion.BuildNumber();
- break;
- case M_OSSERVICEPACK:
- vResult = g_oVersion.CSD();
- break;
- case M_OSLANG:
- if ( g_oVersion.IsWinNT() == true )
- {
- if ( g_oVersion.IsWin2000orLater() == true )
- Util_RegReadString(HKEY_LOCAL_MACHINE,"SYSTEM\\CurrentControlSet\\Control\\Nls\\Language", "InstallLanguage", _MAX_PATH, szValue);
- else // WinNT4
- Util_RegReadString(HKEY_LOCAL_MACHINE,"SYSTEM\\CurrentControlSet\\Control\\Nls\\Language", "Default", _MAX_PATH, szValue);
- vResult = szValue;
- }
- else // Win9x
- {
- Util_RegReadString(HKEY_USERS,".DEFAULT\\Control Panel\\Desktop\\ResourceLocale", "", _MAX_PATH, szValue);
- vResult = &szValue[4];
- }
- break;
- case M_AUTOITVERSION:
- GetModuleFileName (NULL, szValue, sizeof(szValue));
- Util_GetFileVersion(szValue, szValue2);
- vResult = szValue2;
- break;
- case M_AUTOITEXE:
- GetModuleFileName (NULL, szValue, sizeof(szValue));
- vResult = szValue;
- break;
- case M_IPADDRESS1:
- Util_GetIPAddress(1, szInetAddr);
- vResult = szInetAddr;
- break;
- case M_IPADDRESS2:
- Util_GetIPAddress(2, szInetAddr);
- vResult = szInetAddr;
- break;
- case M_IPADDRESS3:
- Util_GetIPAddress(3, szInetAddr);
- vResult = szInetAddr;
- break;
- case M_IPADDRESS4:
- Util_GetIPAddress(4, szInetAddr);
- vResult = szInetAddr;
- break;
- case M_DESKTOPWIDTH:
- GetWindowRect(GetDesktopWindow(), &rTemp);
- vResult = (int)(rTemp.right);
- break;
- case M_DESKTOPHEIGHT:
- GetWindowRect(GetDesktopWindow(), &rTemp);
- vResult = (int)(rTemp.bottom);
- break;
- case M_DESKTOPDEPTH:
- hWnd = GetDesktopWindow();
- hdc = GetDC(hWnd);
- vResult = (int)GetDeviceCaps(hdc, BITSPIXEL);
- ReleaseDC(hWnd, hdc);
- break;
- case M_DESKTOPREFRESH:
- hWnd = GetDesktopWindow();
- hdc = GetDC(hWnd);
- vResult = (int)GetDeviceCaps(hdc, VREFRESH);
- ReleaseDC(hWnd, hdc);
- break;
- case M_COMSPEC:
- GetEnvironmentVariable("COMSPEC", szValue, _MAX_PATH);
- vResult = szValue;
- break;
- case M_TEMPDIR:
- GetTempPath(_MAX_PATH, szValue);
- Util_StripTrailingDir(szValue); // Remove trailing backslash
- vResult = szValue;
- break;
- case M_USERNAME:
- dwTemp = _MAX_PATH;
- GetUserName(szValue, &dwTemp);
- vResult = szValue;
- break;
- #ifndef AUTOITSC
- case M_COMPILED:
- vResult = 0;
- break;
- #else
- case M_COMPILED:
- vResult = 1;
- break;
- #endif
- case M_USERPROFILEDIR:
- // Deceptively difficult as all the API functions for obtaining this rely on IE4+
- if (g_oVersion.IsWinNT())
- GetEnvironmentVariable("USERPROFILE", szValue, _MAX_PATH);
- else
- {
- // Get the users desktop dir and remove the last \ char
- Util_RegReadString(HKEY_CURRENT_USER, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", "Desktop", _MAX_PATH, szValue);
- for (nTemp = (int)strlen(szValue)-1; nTemp >= 0 && szValue[nTemp] != '\\'; --nTemp);
- szValue[nTemp] = '\0';
- }
- vResult = szValue;
- break;
- case M_HOMEDRIVE:
- GetEnvironmentVariable("HOMEDRIVE", szValue, _MAX_PATH);
- vResult = szValue;
- break;
- case M_HOMEPATH:
- GetEnvironmentVariable("HOMEPATH", szValue, _MAX_PATH);
- vResult = szValue;
- break;
- case M_HOMESHARE:
- GetEnvironmentVariable("HOMESHARE", szValue, _MAX_PATH);
- vResult = szValue;
- break;
- case M_LOGONSERVER:
- GetEnvironmentVariable("LOGONSERVER", szValue, _MAX_PATH);
- vResult = szValue;
- break;
- case M_LOGONDOMAIN:
- GetEnvironmentVariable("USERDOMAIN", szValue, _MAX_PATH);
- vResult = szValue;
- break;
- case M_LOGONDNSDOMAIN:
- GetEnvironmentVariable("USERDNSDOMAIN", szValue, _MAX_PATH);
- vResult = szValue;
- break;
- case M_INETGETBYTESREAD:
- vResult = m_InetGetDetails.nBytesRead;
- break;
- case M_INETGETACTIVE:
- vResult = (int)m_InetGetDetails.bInProgress;
- break;
- case M_NUMPARAMS:
- vResult = m_nNumParams;
- break;
- } // end switch
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement