How To Remove Watermark By Programing

Some friends asked me how to remove the watermark by programming, now, I have post a demo to google code. You can found the source code at http://code.google.com/p/removewatermark/

Main steps:
Load the user32.dll.mui into memory by API LoadLibraryEx().
Find the string table by FindResourceEx(), and load it by LoadResource(), LockResource().

Look up the watermark string in string table, we can get the string virtual address and length, then calculate the string offset base the module address, and we get the file offset.
Map the file to memory, just simple zero the watermark string.
In order to make the procedure simple, so use the simplest method.

Finally, re-check sum the file.
OK, all done.



//
// Load mui file to memory
//

HINSTANCE hInstLib = NULL;

hInstLib = LoadLibraryEx(pszFile, NULL, DONT_RESOLVE_DLL_REFERENCES | LOAD_LIBRARY_AS_DATAFILE);
if( NULL == hInstLib )
{
_tcprintf(_T("Fail to open file user32.dll.mui!\n"));
return FALSE;
}


//
// Get file type
//

PIMAGE_DOS_HEADER pDOSHeader = (PIMAGE_DOS_HEADER)((DWORD_PTR)hInstLib - 1);
PIMAGE_NT_HEADERS pNTHeader = (PIMAGE_NT_HEADERS) (pDOSHeader->e_lfanew + (DWORD_PTR)pDOSHeader);

_tcprintf(_T("File type:\t"));
switch (pNTHeader->FileHeader.Machine)
{
case IMAGE_FILE_MACHINE_I386:
_tcprintf(_T("x86"));
break;
case IMAGE_FILE_MACHINE_AMD64:
_tcprintf(_T("x64"));
break;
case IMAGE_FILE_MACHINE_IA64:
_tcprintf(_T("ia64"));
break;

default:
_tcprintf(_T("Unknown\nThis is not a valid file.\n"));

FreeLibrary(hInstLib);
return FALSE;
}



// Load string from resource with special langID
//
BOOL LoadStringExx(
HINSTANCE hInst, // Hinstance of lib
WORD wLangID, // Language ID of resource
PRES_STRING_INFO pInfo // Pointer to the string info
)

{
HRSRC hFindRes; // Handle of the resources has been found
HGLOBAL hLoadRes; // Handle of the resources has been loaded
LPVOID pRes; // Pointer to the resources
UINT nBlockID; // String block ID

pInfo->dwFileOffset = 0; // String offset in the file
pInfo->dwBytes = 0; // String length, in bytes
pInfo->pszText = NULL;

nBlockID = pInfo->uStringID / 16 + 1;

__try
{
// find the string block
hFindRes = FindResourceEx(hInst, RT_STRING, MAKEINTRESOURCE(nBlockID), wLangID);
if(!hFindRes )
{
__leave;
}

hLoadRes = LoadResource(hInst, hFindRes);
if(!hLoadRes )
{
__leave;
}

pRes = LockResource(hLoadRes);
if(!pRes )
{
__leave;
}

WCHAR* pParse = (WCHAR *)pRes; // Pointer to the String block
UINT nIndex = pInfo->uStringID % 16; // Calculate the string index
int nLen;
UINT i;

// 16 strings per block
for( i = 0; i < (nIndex & 15); i++ )
{
pParse += 1 + (int)*pParse;
}

// OK, we get it
nLen = (UINT)*pParse; // The length of the target string.
pParse += 1; // Pointer to the target string


// Main point, calculate the string offset
pInfo->dwFileOffset = (DWORD) ( (DWORD_PTR)pParse - (DWORD_PTR)hInst ) + 1;
pInfo->dwBytes = nLen * sizeof(WCHAR);

// allocate memory
pInfo->pszText = (LPWSTR)MALLOC((nLen + 1) * sizeof(WCHAR));
if (!pInfo->pszText)
__leave;

// copy string for return
CopyMemory((LPVOID)pInfo->pszText, (LPVOID)pParse, pInfo->dwBytes);
*(PWCHAR)((DWORD_PTR)pInfo->pszText + pInfo->dwBytes) = 0;
}
__finally
{
// Clean up, free memory

if (pRes)
UnlockResource(pRes);

if (hFindRes)
FreeResource(hFindRes);
}

// if pointer is null, we return a NULL string
if (!pInfo->pszText)
{
pInfo->pszText = (LPWSTR)MALLOC(sizeof(WCHAR));
pInfo->pszText[0] = 0;
}

return TRUE;

} // LoadStringExx()

发帖者 deepxw 时间: 13:00   |   5 评论  

微软官方确认Windows 2008 / Vista SP2 默认取消TCP/IP半开连接数限制

从去年就存在我脑中的疑问,我一直不能肯定是否安全的修改,而今天微软给了最好的答案。

在TCP-Z中有一个一直没有启用的破解半开连接数限制的方法,从今天微软的文章、和实践中终于可以得到了确认,那个方法是可行的,并且微软的注册表修改方法,最终的就是修改到内核的那个变量。

修改“新建队列”的数值为去实现破解的方法,
TCP-Z最近的那些版本,在右上角会有一锁,用以指示当前是否存在限制。
但它只有软件启动时检测一次。
如果你在tcp-z已经运行后再修改注册表"EnableConnectionRateLimiting",那么那把锁不会自动更新,只有数据图表中的“新建队列”数值会自动更新。

“新建队列”前面的数值为大于等于1,表示当前是限制模式;
“新建队列”前面的数值为等于0,表示当前是无限制模式。
我该是退休的时候了,哈哈。


嗯,那些半开连接数无用论者,记得自己动手打开启用限制啊!

数个为0是无限,数值是1是有限制。
修改完立即生效,无需重启。


Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters]
"EnableConnectionRateLimiting"=dword:00000001

微软网页全文:
如何启用半开 TCP 连接限制在带有 Service Pack 2 的 Windows Vista 和带有 Service Pack 2 的 Windows Server 2008情况默认,在 Service Pack 2 (SP 2) 的 Windows Server 2008 和带有 Service Pack 2 (SP 2) 的 Windows Vista 中禁用了半开 TCP 连接限制。

本文介绍如何实施半开 TCP 连接限制在 SP 2 的 Windows Server 2008 和带有 SP 2 的 Windows Vista 中。 限制为 10 个连接。

请注意 Windows Server 2008 中,和带有 Service Pack 1 (SP 1) 的 Windows Vista 中,系统在任何时候允许最多十个半开 TCP 连接。

如何启用半开 TCP 连接限制重要 此部分、 方法,或任务包含告诉您如何修改注册表的步骤。 但是,如果错误地修改注册表,就可能发生严重的问题。 因此,请确保认真执行这些步骤。
添加的保护注册表之前先备份您修改它。 然后,发生问题时可以还原注册表。

有关如何备份和还原在注册表的详细信息,单击下面的文章编号,以查看 Microsoft 知识库中相应:
322756 (http://support.microsoft.com/kb/322756/ ) 如何备份和还原在 Windows 注册表。

若要能够半开 TCP 连接限制在 SP 2 的 Windows Server 2008 或带有 SP 2 的 Windows Vista 中设置 EnableConnectionRateLimiting DWORD 的值注册表项为 1 (0x00000001)。

要这样做,请按下列步骤操作:

1) 单击 开始 在 开始搜索 框中键入 regedit ,然后再单击 regedit.exe 程序 列表中。
如果将提示您输入管理员密码或进行确认,键入您的密码,或单击 继续 。

2) 找到,然后双击下面的注册表项: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services
\Tcpip\Parameters\EnableConnectionRateLimiting
在在 数值数据 框中键入 1 ,然后单击 确定 。

3) 退出注册表编辑器。

4) 重新启动计算机。

deepxw注解: 其实不需要重新启动计算机!

发帖者 deepxw 时间: 23:19   |   5 评论  

AnalyseBSOD 蓝屏转储文件分析工具

软件名称: AnalyseBSOD (蓝屏分析工具)
操作系统: Windows XP / Vista / Windows 7, 32bit(x86)
Blog: http://zh-deepxw.blogspot.com; http://deepxw.blogspot.com (English)

Download Link 1: AnalyseBSOD_20090503.zip (ZIP File, 33 KB) (点击下载)

AnalyseBSOD 特色:
一款轻量级的蓝屏转储文件分析工具,帮助你快速查找定位导致 Windows 蓝屏的系统文件。
单独运行,无需安装第三方组件;
操作简单。


如何生成内存转储文件。

请按照下列步骤操作:
1) 右键单击“我的电脑”,然后单击“属性”。
2) 单击“高级”选项卡,然后单击“启动和故障恢复”按钮。
3) 单击“写入调试信息”,然后单击以选中“核心内存转储”或“小内存转储”。

完成以上操作后,操作系统在下一次发生蓝屏时将生成转储文件。
利用分析工具,就可以帮助定位故障发生的驱动程序。


注意:
程序只能显示蓝屏时的终止模块。
如果要了解蓝屏的详细过程,请使用高级工具 WinDbg 回溯崩溃现场。


更新历史:
2009-05-03, V1.0.0.1
+ 首次发布。

发帖者 deepxw 时间: 11:28   |   6 评论  

Next previous home
 
Copyright 2009 deepxw | 闲人小作