Raised This Month: $12 Target: $400
 3% 

[T] Small useful codes - Thread


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Sam839
Zero Posts
Join Date: Apr 2019
Old 09-23-2020 , 01:06   [T] Small useful codes - Thread
Reply With Quote #1

Insert your little code that you think should be seen by others. I noticed that there are similar threads and decided to do something similar.

For example:
PHP Code:
// C++
int RGetAppID() // Get AppID from steam_appid.txt
{
    
std::ifstream f("steam_appid.txt");
    
std::string str((std::istreambuf_iterator<char>(f)), std::istreambuf_iterator<char>());
    
str.erase(std::remove(str.begin(), str.end(), char(0x0A)), str.end());
    
str.erase(std::remove(str.begin(), str.end(), char(0x00)), str.end());
    return 
std::stoi(str);
}

// C++
size_t RSizeOfFunction(voidfunc// Get size of function (opcodes - bytes). For example: RSizeOfFunction(AllocConsole);
{
    if (
func) {
        
size_t size 0;
        
BYTEbytes static_cast<BYTE*>(func);
        while (
bytes[size] != 0xC3 && bytes[size 1] != 0xCC)
        {
            if (
size >= 0x100000) { // 1 mByte = 0x100000
                
return size_t(0);
            }
            
size++;
        }
        return 
size 1;
    }
    else {
        return 
size_t(0);
    }

Sam839 is offline
 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 06:02.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode