typedef DWORD
( NTAPI *NTQUERYDEFAULTLOCALE)(
IN BOOLEAN UserProfile,
OUT PLCID DefaultLocaleId );
typedef DWORD
( NTAPI *NTSETDEFAULTLOCALE)(
IN BOOLEAN UserProfile,
IN LCID DefaultLocaleId );
LCID lcid;
DWORD dwTemp;
NTQUERYDEFAULTLOCALE lpfnFunc = NULL;
NTSETDEFAULTLOCALE lpfnFuncSet = NULL;
HINSTANCE hCoreDll = LoadLibrary(TEXT("ntdll.dll"));
if (hCoreDll)
{
lpfnFunc = (NTQUERYDEFAULTLOCALE)GetProcAddress(hCoreDll, _T("NtQueryDefaultLocale"));
if (lpfnFunc)
{
lpfnFunc(TRUE, &lcid);
CString sz;
sz.Format("UserMode default locale is 0x%x", lcid);
MessageBox(sz);
lpfnFunc(FALSE,&lcid);
sz.Format("system default locale is 0x%x", lcid);
MessageBox(sz);
}
lpfnFuncSet = (NTSETDEFAULTLOCALE)GetProcAddress(hCoreDll, _T("NtSetDefaultLocale"));
if (lpfnFuncSet)
{
dwTemp = lpfnFuncSet(FALSE, 0x409);
if (dwTemp == 0)
MessageBox(_T("set system locale to 0x809 successfully"));
}
FreeLibrary(hCoreDll);
}
posted on 2008-10-27 09:48
Sean 阅读(339)
评论(0) 编辑 收藏 引用