Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bool fSendPacket(String^ strPacket, String^&strError){
- if(!isGoodPacket(strPacket, strError))
- return false;
- Random^ randObj = gcnew Random();
- String^ rawBytes = String::Empty;
- for(int i = 0; i < strPacket->Length; i++){
- if(strPacket[i] == '*'){
- rawBytes += randObj->Next(16).ToString("X");
- }
- else
- rawBytes += strPacket[i];
- }
- //SRC ZPE
- using namespace System::Globalization;
- ::DWORD dwOffset = 0;
- ::DWORD dwLength = ( rawBytes->Length / 2 );
- ::LPBYTE lpBytes = new ::BYTE [ dwLength ];
- for ( int i = 0; ( dwOffset < dwLength ) && ( ( i + 1 ) < rawBytes->Length ); dwOffset++, i += 2 )
- lpBytes[dwOffset] = Byte::Parse(rawBytes->Substring(i, 2), NumberStyles::HexNumber, CultureInfo::InvariantCulture);
- try {
- SendPacket(lpBytes, dwLength);
- } catch ( Exception^ ) {
- } finally {
- delete [] lpBytes;
- }
- return true;
- }
Add Comment
Please, Sign In to add comment