|
[求助]如何运行在远程计算机上的程序
use WMI, either via script or C# or code yourself in C/Delphi or whatever your favorite language. Check www.codeproject.com or google "WMI", tons of such info. BTW, "只要能开个CMD就可以了 CMD下找到路径运行就成了呗" <--- this just run the app on your current host machine, of your current login session; NOT from the remote machine. BE AWARE of the concept differences. |
|
|
|
[有奖活动]“美丽的代码”征集大赛
People have posted this thousands of times. Just a heads up and see if u could get it better. Hey you jerks, are u sleeping?... __inline HRESULT HRESULT_FROM_LAST_ERROR( VOID ) { DWORD dwError = GetLastError(); return HRESULT_FROM_WIN32( dwError ); } HRESULT AdjustProcessPrivilege(VOID) { HANDLE hToken = INVALID_HANDLE_VALUE; TOKEN_PRIVILEGES tkp; HRESULT result = S_OK; if ( ! OpenProcessToken( GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken ) ) { result = HRESULT_FROM_LAST_ERROR(); goto Done; } if( ! LookupPrivilegeValueA( NULL, "SeDebugPrivilege", &(tkp.Privileges[0].Luid) ) ) // Get the LUID for the privilege. { result = HRESULT_FROM_LAST_ERROR(); goto Done; } tkp.PrivilegeCount = 1; // one privilege to set tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED; if( ERROR_SUCCESS != AdjustTokenPrivileges( hToken, FALSE, &tkp, sizeof(TOKEN_PRIVILEGES), (PTOKEN_PRIVILEGES) NULL, 0 ) ) { result = HRESULT_FROM_LAST_ERROR(); } if( ERROR_NOT_ALL_ASSIGNED == GetLastError() ) // the token does not have all the privileges adjusted { result = E_FAIL; } Done: if( INVALID_HANDLE_VALUE != hToken ) { CloseHandle( hToken ); } return result; } |
|
[下载]Windows via C/C++ (Pro - Developer) by Jeffrey Richter, Christophe Nasarre
Why not upload the file here and let everyone download it? Should be super-easy for you and much better for everyone else. The rapidshare site is kind of "buggy" and always ask you for $$$ before you can really do something. Come on and help us...appreciated |
|
[求助]寻找关于anti-debug的delphi源码
http://www.securityfocus.com/infocus/1893 |
|
[作品提交]Hash计算器
抱歉,这是开发的工具软件中的一个,没打算开源,故无法提供源代码。大赛并未 规定提供完整的源代码,不算违规。遗憾的是忘了提交日期。 这里有其中的一个function,供demo之用。很多人写程序都是不注意细节和格式的, 交流起来就达不到共同提高的目的。 // *-------------------------------------------------------------------------------------------------------------- // copy string to clipboard extern HRESULT WINAPI Base_CopyMsgToClipboardW( __deref_in LPCWSTR pwszMsg ) { HRESULT hr = S_OK; HGLOBAL hClipBuffer = INVALID_HANDLE_VALUE; WCHAR* wszChar = NULL; size_t dwSize = 0; if( NULL == pwszMsg ) return E_INVALIDARG; if( 0 == OpenClipboard( GetForegroundWindow() ) || 0 == EmptyClipboard( ) || FAILED( hr = StringCbLengthW( pwszMsg, (DWORD)-1, &dwSize ) ) ) { hr = HRESULT_FROM_LAST_ERROR(); goto Done; } if( NULL == (hClipBuffer = GlobalAlloc( GMEM_DDESHARE | GMEM_MOVEABLE, dwSize + 10 ) ) || NULL == ( wszChar = (WCHAR*) GlobalLock( hClipBuffer ) ) ) { hr = HRESULT_FROM_LAST_ERROR(); goto Done; } #pragma warning( disable : 6386 ) // VS2005: disable warning as we know it's safe: a bug in VS2005? StringCchCopyW( wszChar, (dwSize + 10)/2, pwszMsg ); #pragma warning( default : 6386 ) GlobalUnlock( hClipBuffer ); if( NULL == SetClipboardData( CF_UNICODETEXT, hClipBuffer ) || 0 == CloseClipboard() ) hr = HRESULT_FROM_LAST_ERROR(); Done: if( INVALID_HANDLE_VALUE != hClipBuffer && NULL != GlobalFree( hClipBuffer ) ) hr = HRESULT_FROM_LAST_ERROR(); return hr; } // *-------------------------------------------------------------------------------------------------------------- extern __inline HRESULT HRESULT_FROM_LAST_ERROR( VOID ) { DWORD dwError = GetLastError(); return HRESULT_FROM_WIN32( dwError ); } |
|
[作品提交]Hash计算器
运行该程序,你需要local admin的权限,否则会报错。 |
|
[求助]2003下的MFC程序报错
仔细检查一下你的程序里调用的win32 API和你使用的参数,99%的可能性是某个API在win server 2003下的功能和xp/2000下有微弱的差别,导致API调用失败和程序垮掉(估计你的程序也是不检查API地返回值,也没有异常检查exception handling)。 |
|
[求助]关于链接时出的错误 error LNK2001: unresolved external symbol
Could be my wrong understanding. Seems that the compiler thinks the APIs your code referenced is in C++, and in fact these functions are in C, I mean the calling style. Since your code is in assembly, I'm not sure how to deal with that. But if your code is in C/C++,better use #ifdef __cplusplus. For your own exported functions, better do it in this way, for example: extern "C" yourFunc(...) |
|
你知道更简洁的创建桌面快捷键的程序吗? ^_^
程序就这么难写吗? C/C++,C#,VB, x86 assembly... whatever you can think of and you can do ... |
|
请教一个关于Windows提权的问题
附: GetLastError()返回的错误值仅仅和你的当前的thread有关,和进程内其它的线程无关(not process-wide),可以放心使用。 Linux里的errno也是一样的,each thread has its own errno。 |
|
请教一个关于Windows提权的问题
认真、仔细地看看MSDN里对各个函数的解释,对提高程序的质量有很大帮助。很多bug其实就是粗心所致。比如AdjustTokenPrivileges,看看MSDN怎么说: Return Values If the function succeeds, the return value is nonzero. To determine whether the function adjusted all of the specified privileges, call GetLastError, which returns one of the following values when the function succeeds ERROR_SUCCESS The function adjusted all specified privileges. 在Vista上该方法可能会失败,取决于你的权限和目标进程的所有者的权限,微软对process ACL的内部处理做了不小的改动,安全性较之XP和2003有一定的提高,当然还是有很多问题和bug。 |
|
请教一个关于Windows提权的问题
You just passed the wrong parameter, buddy. Try mine and see if that works. BOOL EnablePrivileges( VOID ) { HANDLE hToken; TOKEN_PRIVILEGES tkp; BOOL Result = FALSE; WCHAR wszMsg[MAX_PATH] = {0}; if ( ! OpenProcessToken( GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken ) ) return FALSE; LookupPrivilegeValue( NULL, SE_DEBUG_NAME, &(tkp.Privileges[0].Luid) ); // Get the LUID for the privilege. tkp.PrivilegeCount = 1; // one privilege to set tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED; AdjustTokenPrivileges( hToken, FALSE, &tkp, sizeof(TOKEN_PRIVILEGES), (PTOKEN_PRIVILEGES) NULL, 0 ); DWORD dwError = GetLastError(); if( ERROR_SUCCESS == dwError ) Result = TRUE; else { StringCchPrintfW( wszMsg, MAX_PATH, L"\tError: EnablePrivileges() fails with error code %x.\n", dwError ); OutputDebugStringW( wszMsg ); } CloseHandle( hToken ); return Result; } |
操作理由
RANk
{{ user_info.golds == '' ? 0 : user_info.golds }}
雪币
{{ experience }}
课程经验
{{ score }}
学习收益
{{study_duration_fmt}}
学习时长
基本信息
荣誉称号:
{{ honorary_title }}
能力排名:
No.{{ rank_num }}
等 级:
LV{{ rank_lv-100 }}
活跃值:
在线值:
浏览人数:{{ visits }}
最近活跃:{{ last_active_time }}
注册时间:{{ user_info.create_date_jsonfmt }}
勋章
兑换勋章
证书
证书查询 >
能力值