1. How to calculate the data range of the basic data type
# Include <iostream. h>
Int main ()
{
Unsigned int I =-1;
Cout <I <Endl;
Return 0;
}
Others can be obtained similarly. Divide by two to be the largest positive value of the int type.
No need to know the number of bytes
Or
Int main ()
{
Int m = 0;
Printf ("max = % u ,",~ M );
Return 0;
}
2. Three Methods to convert an integer into a binary representation:
Method 1:
-
C/C ++ code
-
int n;cin>>n;bitset<8> ibs(n);cout<<ibs<<endl;
Method 2:
-
C/C ++ code
-
int getTwo(int n){ int num[32]; const int MAX = sizeof(int)*8; for(int i = 0; i < MAX; i++) { if((n >> i) & 0x01 == 1) { num[i] = 1; } else { num[i] = 0; } } for(i = MAX-1; i!=-1; --i) { cout<<num[i]; } return count;}
Method 3:
Void trans (int n)
{
Int X;
X = n % 2;
N = n/2;
If (n! = 0)
{
Trans (N );
}
Switch (X)
{
Case 10: cout <'a'; break;
Case 11: cout <'B'; break;
Case 12: cout <'C'; break;
Case 13: cout <'D'; break;
Default: cout <X;
}
}
3. rundll32.exe D:/hacker. dll dllmain
This sentence refers to injecting D:/hacker. DLL into rundll32.exe and executing the output function: dllmain
4. User-Defined Function entry
# Pragma comment (linker, "/entry: entrypoint ")
Void entrypoint ()
{
Int nret = winmain (getmodulehandle (null ),
Null,
Getcommandline (),
Sw_shownormal );
Exitprocess (nret );
}
Int winapi winmain (hinstance, // handle to current instance
Hinstance hprevinstance, // handle to previous instance
Lpstr lpcmdline, // command line
Int ncmdshow // show state
)
{
//
Return 0;
}