小编Chr*_*ian的帖子

编译器抱怨我的默认参数?

我从这段代码中遇到了麻烦,在我从main.cpp文件中取出这个类并将其拆分为.h和.cpp后,编译器开始抱怨我在void中使用的默认参数.

/* PBASE.H */
    class pBase : public sf::Thread {
private:
    bool Running;

public:
    sf::Mutex Mutex;
    WORD OriginalColor;
    pBase(){
        Launch();
        Running = true;
        OriginalColor = 0x7;
    }
    void progressBar(int , int);
    bool key_pressed();
    void setColor( int );
    void setTitle( LPCWSTR );
    bool test_connection(){
        if(Running == false){
            return 0;
        }
        else{
            return 1;
        }
    return 0;
    }
    void Stop(){
        Running = false;
        if(Running == false) Wait();
    }
};
Run Code Online (Sandbox Code Playgroud)
    /* PBASE.CPP */

    // ... other stuff above

    void pBase::setColor( int _color = …
Run Code Online (Sandbox Code Playgroud)

c++ class optional-parameters

47
推荐指数
2
解决办法
5万
查看次数

C++,Cheat Engine/OllyDBG从多级指针中查找基本的"静态"地址

我又回来了,沮丧,拼命寻求帮助:D.

我试图为一个简单的程序创建一个作弊,它基本上是一个.dll文件,当它使用它的基地址注入它时,它将改变主程序的整数值.问题是,我找不到使用作弊引擎主要是因为有多个级别指针与NEGATIVE?偏移.例如:

//Starting pointer address
0x0033FCF0 -> 200

//Finding second level pointer using "Find out what's accessing this address" in Cheat Engine
**(mov eax,[ebp+08])** // **EAX=0x00000007** , **EPB=0x0033FCE8 => mov 00000007,[0033FCE8+08]**

2nd Level Pointer:
**(0033FCE8+18) -> 200**
Run Code Online (Sandbox Code Playgroud)

所以我继续使用"找出什么是......"来找到下一个指针,但是当使用T-SEARCH和第二级指针地址时,我会得到7到8个新的静态地址.

问题是,我不知道哪一个是正确的,因为作弊引擎REFUSES让我使用NEGATIVE添加指针?偏移.

例:

Base Pointer:
**mov eax,[epb-18] !!!** // Notice the **MINUS**
Run Code Online (Sandbox Code Playgroud)

并且除了一切之外,Cheat Engine拒绝接受具有负偏移的指针!

那么,是否有另一种从多个级别指针中查找基址的方法?欢迎OlyDBG/Idapro解决方案.非常感谢你们!

这是我试图破解的简单程序的源代码:

#include <iostream>
#include <conio.h>
#include <windows.h>
#include <stdlib.h>

int main(){
    int hp = 100;
    while(1){
        std::cout << hp << std::endl;
        Sleep(3000);
        hp += 10;
        system("cls");
    }
    return …
Run Code Online (Sandbox Code Playgroud)

c++ pointers offset memory-address

6
推荐指数
1
解决办法
1万
查看次数

Windows API SendMessage + WM_SETTEXT 导致崩溃

我遇到了 SendMessageA(handle,WM_SETTEXT,0,(LPARAM)text); 如果在构造函数之外的任何其他地方使用它会导致崩溃。

MWC.h

#include <Windows.h>
#include <iostream>
#include <string>

class MWC{
private:
    MSG msg;
public:
    MWC();
    ~MWC();
    int mLoop();
    int mClose(UINT);
    class System{
    public:
        System(){ }
        ~System(){ }
        class Form{
        public:
            HWND handle; // Need to access it in order to create other controls
            Form(char*,int,int,int,int);
            Form(char*,int,int);
            ~Form(){ }
            bool Show();
            HWND ReturnHandle();
        };
        class TextBox{
        protected:
            HWND handle;
        private:
            int ID;
        public:
            TextBox(char* text,int width,int height,int x,int y,int id,Form* p);
            TextBox(int width,int height,int x,int y,int id,Form* p);
            ~TextBox(){ } …
Run Code Online (Sandbox Code Playgroud)

c++ crash winapi sendmessage

3
推荐指数
1
解决办法
7651
查看次数

从编辑控件(Pure Win32 API)获取文本

我一直试图让这个工作年龄相似,但没有用(悲伤的脸).

int iChars = GetWindowTextLength (GetDlgItem(handle,ID))+1; // Room for '\0'
char* pstrText;
pstrText = (char*) malloc (sizeof(char)*iChars);
if (pstrText != NULL) {
    //GetWindowText (GetDlgItem(handle,ID), pstrText, iChars);
        GetDlgItemText(handle,ID,pstrText,iChars);
}
return pstrText; // Memory gets freed after it returns
Run Code Online (Sandbox Code Playgroud)

工作范例:

char* MWC::System::TextBox::GetText(){
    int len = SendMessage(handle, WM_GETTEXTLENGTH, 0, 0);
    char* buffer = new char[len];
    SendMessage(handle, WM_GETTEXT, (WPARAM)len+1, (LPARAM)buffer);
    return buffer;
}
Run Code Online (Sandbox Code Playgroud)

c++ winapi controls edit gettext

3
推荐指数
1
解决办法
2万
查看次数

关于struct padding

假设我们有一个数据包

struct Foo
{
    short size; // 2
    short type; // 2
    BYTE  data; // 1
    //1 byte padding not 3?
};
Run Code Online (Sandbox Code Playgroud)

编译后,它的长度为6个字节,在结构的末尾添加了1个字节的填充.是不是编译器应该添加3个字节填充,以便结构大小是8个字节长?因为32位cpu喜欢以4字节块的形式访问数据

顺便说一下#pragma pack(1)它的长度是5个字节,正如预期的那样.

c++ struct padding packet

3
推荐指数
1
解决办法
234
查看次数

C++ 无法从 main.cpp 中的另一个文件实例化一个类

我不能让它工作

地址

#ifndef ADDR_H
#define ADDR_H

class Foo{
public:
  Foo();                  // function called the default constructor
  Foo( int a, int b );    // function called the overloaded constructor
  int Manipulate( int g, int h );

private:
  int x;
  int y;
};

#endif
Run Code Online (Sandbox Code Playgroud)

地址文件

#include "addr.h"


Foo::Foo(){
  x = 5;
  y = 10;
}
Foo::Foo( int a, int b ){
  x = a;
  y = b;
}

int Foo::Manipulate( int g, int h ){
  return x = h + g*x;
} …
Run Code Online (Sandbox Code Playgroud)

c++ linker class

0
推荐指数
1
解决办法
8746
查看次数