Advertisement
Guest User

Untitled

a guest
Jul 27th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. GenerateSerial      PROC uses ebx edx esi edi lpszName:DWORD, pProductID:DWORD, dwMajorVersion:DWORD
  2.  
  3.     LOCAL   szTemp[256]:BYTE
  4.     LOCAL   szTemp2[256]:BYTE
  5.     LOCAL   MD5Result:MD5Struct
  6.     LOCAL   dwImul:DWORD
  7.     LOCAL   dwFirstVal:DWORD
  8.     LOCAL   dwSecondVal:DWORD
  9.     LOCAL   dwThirdVal:DWORD
  10.     LOCAL   dwFourthVal:DWORD
  11.     LOCAL   dwStringDWORDs[3]:DWORD
  12.     LOCAL   dwSerialDWORD1:DWORD
  13.     LOCAL   dwSerialDWORD2:DWORD
  14.    
  15.     invoke wsprintf,ADDR szTemp,offset szFmt1, dword ptr [lpszName]
  16.     invoke GetStringMD5,ADDR szTemp,ADDR MD5Result
  17.    
  18.    
  19.     mov esi,dword ptr [pProductID]
  20.     invoke lstrlen,esi
  21.     movzx eax,byte ptr [esi+eax-1] 
  22.     mov dword ptr [dwImul],eax
  23.    
  24.     invoke StrToInt,esi
  25.     add eax,dword ptr [dwMajorVersion]
  26.     imul eax, dword ptr [dwImul]
  27.    
  28.     invoke wsprintf,ADDR szTemp2, offset szFmt2, dword ptr [dwImul], eax, dword ptr [dwMajorVersion], eax
  29.    
  30.     mov byte ptr [szTemp2+10],0
  31.    
  32.     mov eax,dword ptr [dwMajorVersion]
  33.     add eax, 1Fh
  34.     mov dword ptr [dwFirstVal],eax
  35.    
  36.     mov eax,dword ptr [dwMajorVersion]
  37.     add eax, 21h
  38.     mov dword ptr [dwSecondVal],eax
  39.    
  40.     fild dword ptr [dwFirstVal]
  41.     fsin
  42.     fmul dword ptr [dwFMulVal]
  43.     invoke GetFPUVal
  44.     cdq
  45.     xor eax,edx
  46.     sub eax,edx
  47.     mov dword ptr [dwThirdVal],eax
  48.    
  49.     fild dword ptr [dwSecondVal]
  50.     fcos
  51.     fmul dword ptr [dwFMulVal]
  52.     invoke GetFPUVal
  53.     cdq
  54.     xor eax,edx
  55.     sub eax,edx
  56.     mov dword ptr [dwFourthVal],eax
  57.  
  58.     .if dwThirdVal > 9
  59.         .repeat
  60.             add dwThirdVal, -1Fh
  61.         .until dwThirdVal < 9
  62.     .endif
  63.    
  64.     .if dwFourthVal > 9
  65.         .repeat
  66.             add dwFourthVal, -21h
  67.         .until dwFourthVal < 9
  68.     .endif 
  69.    
  70.     xor edi,edi
  71.     xor edx,edx
  72.     mov ecx,dwThirdVal
  73.     .repeat
  74.         movsx eax,byte ptr [MD5Result.Result+edx]
  75.         add edi,eax
  76.         shl edi,cl
  77.         add edx,1
  78.     .until edx == 10h
  79.    
  80.     mov ebx,dwThirdVal
  81.    
  82.     mov eax,edi
  83.     xor edx,edx
  84.     div ebx
  85.     cdq
  86.     xor eax,edx
  87.     sub eax,edx
  88.     mov dwStringDWORDs[0*4],eax
  89.    
  90.     imul ebx,edi
  91.     mov eax,ebx
  92.     cdq
  93.     xor eax,edx
  94.     sub eax,edx
  95.     mov dwStringDWORDs[1*4],eax
  96.    
  97.     mov eax,edi
  98.     cdq
  99.     xor eax,edx
  100.     sub eax,edx
  101.     mov dwStringDWORDs[2*4],eax
  102.     invoke wsprintf,ADDR szTemp, offset szFmt3,  dwStringDWORDs[2*4], dwStringDWORDs[1*4], dwStringDWORDs[0*4]
  103.  
  104.     invoke StrToInt,ADDR szTemp
  105.     cdq
  106.     xor eax,edx
  107.     sub eax,edx
  108.     mov dwSerialDWORD1,eax
  109.    
  110.     xor edi,edi
  111.     xor edx,edx
  112.     mov ecx,dwFourthVal
  113.         jmp @f
  114.          
  115.     .repeat
  116.         movsx eax,al
  117.         add edi,eax
  118.         shl edi,cl
  119.         add edx,1
  120.     @@::   
  121.         mov al, byte ptr [szTemp2+edx]
  122.     .until !al
  123.        
  124.    
  125.     mov ebx,dwFourthVal
  126.     mov eax,edi
  127.     xor edx,edx
  128.     div ebx
  129.     cdq
  130.     xor eax,edx
  131.     sub eax,edx
  132.     mov dword ptr [dwStringDWORDs+0*4],eax
  133.    
  134.     imul ebx,edi
  135.     mov eax,ebx
  136.     cdq
  137.     xor eax,edx
  138.     sub eax,edx
  139.     mov dword ptr [dwStringDWORDs+1*4],eax
  140.    
  141.     mov eax,edi
  142.     cdq
  143.     xor eax,edx
  144.     sub eax,edx
  145.     mov dword ptr [dwStringDWORDs+2*4],eax
  146.    
  147.     invoke wsprintf,ADDR szTemp, offset szFmt3,  dwStringDWORDs[2*4], dwStringDWORDs[1*4], dwStringDWORDs[0*4]
  148.  
  149.     invoke StrToInt,ADDR szTemp
  150.     cdq
  151.     xor eax,edx
  152.     sub eax,edx
  153.     mov dwSerialDWORD2,eax
  154.        
  155.  
  156.     mov eax,dwLangID
  157.     invoke wsprintf,offset szRegString,offset szFmt4,dword ptr [dwLanguages+eax*4],dwSerialDWORD1, dwSerialDWORD2,offset szSuffix1
  158.     mov eax, offset szRegString
  159.     Ret
  160. GenerateSerial EndP
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement