Guest User

Untitled

a guest
Oct 23rd, 2017
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. bool fSendPacket(String^ strPacket, String^&strError){
  2. if(!isGoodPacket(strPacket, strError))
  3. return false;
  4.  
  5. Random^ randObj = gcnew Random();
  6. String^ rawBytes = String::Empty;
  7.  
  8. for(int i = 0; i < strPacket->Length; i++){
  9. if(strPacket[i] == '*'){
  10. rawBytes += randObj->Next(16).ToString("X");
  11. }
  12. else
  13. rawBytes += strPacket[i];
  14. }
  15.  
  16. //SRC ZPE
  17. using namespace System::Globalization;
  18.  
  19. ::DWORD dwOffset = 0;
  20. ::DWORD dwLength = ( rawBytes->Length / 2 );
  21. ::LPBYTE lpBytes = new ::BYTE [ dwLength ];
  22.  
  23. for ( int i = 0; ( dwOffset < dwLength ) && ( ( i + 1 ) < rawBytes->Length ); dwOffset++, i += 2 )
  24. lpBytes[dwOffset] = Byte::Parse(rawBytes->Substring(i, 2), NumberStyles::HexNumber, CultureInfo::InvariantCulture);
  25.  
  26. try {
  27. SendPacket(lpBytes, dwLength);
  28. } catch ( Exception^ ) {
  29. } finally {
  30. delete [] lpBytes;
  31. }
  32. return true;
  33. }
Add Comment
Please, Sign In to add comment