我不太擅长 C++,更擅长 C# 和 PHP。我被分配了一个项目,需要我使用GetTickCount并连接到一个应用程序。我需要一些帮助,因为由于某种原因它没有按计划工作...这是挂钩的代码,我知道它有效,因为我以前在项目中使用过它。我唯一不太确定的是GetTickCount它的一部分。我尝试GetTickCount64认为这可以解决我的问题(它没有使我注入的内容崩溃),但发现它根本不起作用,所以它没有崩溃。
bool APIENTRY DllMain(HINSTANCE hDll, DWORD dwReason, LPVOID lpReserved)
{
switch(dwReason)
{
case DLL_PROCESS_ATTACH:
DisableThreadLibraryCalls(hDll);
CreateThread(0,0, (LPTHREAD_START_ROUTINE)KeyHooks, 0, 0, 0);
GetTickCount_orig = (DWORD (__stdcall *)(void))DetourFunction((PBYTE)GetProcAddress(GetModuleHandle("kernel32.dll"), "GetTickCount"), (PBYTE)GetTickCount_hooked);
case DLL_PROCESS_DETACH:
DetourRemove((PBYTE)GetProcAddress(GetModuleHandle("kernel32.dll"), "GetTickCount"), (PBYTE)GetTickCount_hooked);
break;
}
return true;
}
Run Code Online (Sandbox Code Playgroud)
这是用于的其余代码GetTickCount
DWORD oldtick=0;
DWORD (WINAPI *GetTickCount_orig)(void);
DWORD WINAPI GetTickCount_hooked(void)
{
if(oldtick==0)
{
oldtick=(*GetTickCount_orig)();
return oldtick;
}
DWORD factor;
DWORD ret;
ret = (*GetTickCount_orig)();
factor = 3.0;
DWORD newret;
newret = ret+((oldtick-ret)*(factor-1));
oldtick=ret; …Run Code Online (Sandbox Code Playgroud) 替换字节数组中某些字节的最佳方法是什么?
例如,我有bytesFromServer = listener.Receive(ref groupEP);,我可以做到BitConverter.ToString(bytesFromServer)将其转换为可读格式,以返回一些东西
48 65 6c 6c 6f 20
74 68 65 72 65 20
68 65 6c 70 66 75
6c 20 70 65 6f 70
6c 65
Run Code Online (Sandbox Code Playgroud)
我想将"68 65 6c"中的内容替换成类似"68 00 00"的内容(仅作为示例).字节[]上没有.Replace().
是否有一种简单的方法将其转换回字节[]?
任何帮助赞赏.谢谢!
从我的字节[512]中删除额外00-00-00-00-00的最佳方法是什么?
目前,当我从一个不是512字节的接收数据包中加载一些数据时,它会返回类似的内容
Byte[] received = new Byte[512];
int Recieving = Sockitty.ReceiveFrom(received, ref endPoint132);
string dataReceived = BitConverter.ToString(received);
txtReceived.AppendText(dataReceived);
//Outputs the following
74 68 69 73 20 69 73 20 61
20 74 65 73 74 00 68 65 6c
6c 6f 20 00 68 65 72 65 2e
**00** 00 00 00 00 00 00 00 00 //This is the part that needs to be removed but the stared 00.
00 00 00 00 00 00 00 00 00
00 …Run Code Online (Sandbox Code Playgroud) 查找字符串是否包含 url 的最佳方法是什么?
我正在写一个聊天框,需要拒绝在其中发布网址...
if(preg_match('/[a-zA-Z]+:\/\/[0-9a-zA-Z;.\/?:@=_#&%~,+$]+/', $clean_message, $matches))
{
die('INVALID!');
}
Run Code Online (Sandbox Code Playgroud)
似乎对包含 http:// 的网址有用,但我还需要能够拒绝 youtube.com 等网址,以及是否发布了 ipaddress 等。
我需要从用户发送垃圾邮件的 url 中保持聊天框干净!
我一直在尝试在过去的4个小时内创建一个正则表达式以获取下面的信息并将其全部添加到我可以运行forloop的数组中.在大约2个小时内,如果这不起作用,304人将不会收到一条短信,显示我们的学校系统现已取消.
http://www.wane.com/generic/weather/closings/School_Delays_and_Closings
<tr class="B">
<td width="35%">Blackhawk Christian School</td>
<td width="25%">Allen</td>
<td width="80%">2 Hour Delay </td>
</tr>
<tr class="S">
<td width="35%">Southwest Allen County Schools</td>
<td width="25%">Allen</td>
<td width="80%">2 Hour Delay </td>
</tr>
Run Code Online (Sandbox Code Playgroud)
我需要的是foreach td width="35%"将它添加到数组中,其中包含学校系统的td wdith="80%"信息和信息.因为我不需要仅针对一个学校系统,我需要在列表中检查所有这些并将其显示给用户.
我正在做:
$wanetv = get_url_contents("http://www.wane.com/generic/weather/closings/School_Delays_and_Closings");
Run Code Online (Sandbox Code Playgroud)
抓住网页.
编辑:
试图将下面发布的一些C#转换为PHP ...无法弄明白.这是我的尝试:
$a = "<tr class='B'> <td width='35%'>Blackhawk Christian School</td> <td width='25%'>Allen</td> <td width='80%'>2 Hour Delay </td> </tr> <tr class='S'> <td width='35%'>Southwest Allen County Schools</td><td width='25%'>Allen</td><td width='80%'>2 Hour Delay </td> </tr> ";
$SchoolNameKeyword = "<td width='35%'>";
$DelayKeyword = "<td …Run Code Online (Sandbox Code Playgroud) 有strcpy的一些问题......
得到此错误:
strcpy' : cannot convert parameter 2 from 'WCHAR *' to 'const char *
这是代码......
char FunctionName[ 256 ];
UFunction *pUFunc = NULL;
strcpy( FunctionName, pUFunc->GetFullName() );
Run Code Online (Sandbox Code Playgroud)
并且:
WCHAR* UObject::GetFullName ()
{
if ( this->Class && this->Outer )
{
static WCHAR ObjectName[ 256 ];
if (Outer == NULL)
{
wsprintf(ObjectName, L"");
}
else
{
if (Outer->Outer)
wsprintf(ObjectName, L"%s %s.%s.%s", Class->Name.GetName(), Outer->Outer->Name.GetName(), Outer->Name.GetName(), Name.GetName());
else if(Outer)
wsprintf(ObjectName, L"%s %s.%s", Class->Name.GetName(), Outer->Name.GetName(), Name.GetName());
}
return ObjectName;
}
return L"(null)";
}
Run Code Online (Sandbox Code Playgroud)