Skip to content

C / C++ / MFC

C, Visual C++ and MFC discussions

This category can be followed from the open social web via the handle c-c-mfc@forum.codeproject.com

111.5k Topics 465.7k Posts
  • 0 Votes
    8 Posts
    3 Views
    M
    Price. (oh, and usefulness)
  • Is it possible to find if an application is encrypted at runtime

    c++ help
    5
    0 Votes
    5 Posts
    0 Views
    L
    Hi, manoharbalu wrote: Is it possible to write a code inside the application to find it at runtime. Maybe. manoharbalu wrote: Can anyone help me in this regard One of the first thing at occurs after the executable begins execution... (For brevity I will not describe the NT loader) is that it jumps to the IMAGE_OPTIONAL_HEADER.AddressOfEntryPoint and begins executing some code there. Do the following: 1.) Protect around a dozen files with the packer/protector. 2.) Read some bytes at the IMAGE_OPTIONAL_HEADER.AddressOfEntryPoint offset on all these protected files. (maybe 16 bytes of instructions) 3.) Save those bytes into an array. 4.) If all those bytes are the same... use that for your signature detection. All PE packers and protections add the decryption/decompressing functions at the IMAGE_OPTIONAL_HEADER.AddressOfEntryPoint Note that in the old days some vendors used polymorphic instruction generators to avoid detection... but these days most vendors are using static instructions so that anti-virus vendors can detect the unpacker signature. Note that you can also iterate through the PE sections... A typical PE file from a Microsoft based compiler will contain: .text .bss .rdata .data .idata .reloc ... few others I believe the HASP SRM packer/protector generates an additional PE section: .protect Keep in mind that you are performing a statistical analysis so... if the instructions at IMAGE_OPTIONAL_HEADER.AddressOfEntryPoint are the same as instructions from other binaries packed with HASP SRM { if There is an additional section named .protect which is consistent with the HASP SRM product. { Probably protected by HASP SRM } } Best Wishes, -David Delaune
  • Problem with List Control in visual c++

    c++ help
    3
    0 Votes
    3 Posts
    1 Views
    L
    Thank you very much sir!!It worked!!! :-D :)
  • RegGetValue and SHRegGetValue

    visual-studio help
    3
    0 Votes
    3 Posts
    1 Views
    L
    ForNow wrote: I have included WinReg.h yet intellisense points me to SHRegGetValue define _WIN32_WINNT as 0x0600 or later.
  • 0 Votes
    9 Posts
    0 Views
    L
    Hi, Sounds like you are compiling ImageMagick without any image libraries. Rajeev Raina wrote: Magick:: Image image (No error)image.read("5.png") throws an error "ErrorMissingDelegate at memorry location ....".I tried other image formats also, but same error. LIBPNG[^] LIBJPEG[^] LibTIFF[^] Many others... Then recompile with: ./configure --with-png=yes --with-jpeg=yes --with-tiff=yes It can be alot of work... you might be better off downloading a precompiled binary: Install from Binary Distribution @ ImageMagick[^] Best Wishes, -David Delaune
  • Using EasySize

    question help
    3
    0 Votes
    3 Posts
    0 Views
    M
    If you download the source code of the [following article](https://www.codeproject.com/Articles/1657/EasySize-Dialog-resizing-in-no-time) , you will see examples of different alignments of controls. - Michael Haephrati מיכאל האפרתי
  • 0 Votes
    3 Posts
    0 Views
    L
    The generic answer is you can use __VA_ARGS__ its used to pass variable arguments thru macros, something like this is generally how it used to feed a multi variable function #define LOG_DEBUG(...) printf(__VA_ARGS__) For what you are doing you pass the arguments thru two macros the first take any number of variables the second macro enforces it is using just two values. #define PA0 GPIOA, GPIO_PIN0 #define PIN_DEF_A(A, B) \ GPIO_TypeDef* PORT; \ uint16_t PIN; #define PIN_DEF(...) PIN_DEFA(__VA_ARGS__) Your code doesn't make a lot of sense to me because I can't see the types. I am guessing GPIO_TypeDef* is a volatile to a 16 bit port and what you are trying to do is MACRO the output of a 16 bit value which would usually look actually like this *((volatile uint16_t*) 0xXXXXXXXXX = 0x????; // So something like this ... send 0x1234 to port 0x3F000000 *((volatile uint16_t*) 0x3F000000) = 0x1234; Using the above macro form for that would be #define PA0 0x3F000000,0x1234 #define PIN_DEFA(A, B) *((volatile uint16_t*) (A)) = (B) #define PIN_DEF(...) PIN_DEFA(__VA_ARGS__) //USING IT PIN_DEF(PA0); // This expands to *((volatile uint16_t*) 0x3F000000) = 0x1234; In vino veritas
  • sha code

    c++ tutorial
    4
    0 Votes
    4 Posts
    0 Views
    D
    Member 11855697 wrote: ...but when i run my main.cpp it says, no such file or directory What in the world is this supposed to mean? How do you run a .cpp file? "One man's wage rise is another man's price increase." - Harold Wilson "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons "You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
  • 0 Votes
    5 Posts
    0 Views
    L
    Without seeing your code it is impossible to comment.
  • AES 128 block cipher problem running

    help tutorial csharp html asp-net
    3
    0 Votes
    3 Posts
    0 Views
    R
    Hi here you go: The header file, aes.h: #ifndef AES_H #define AES_H #include #include using namespace std; class aes { public: aes(vector& , vector&, unsigned int); ~aes(); vector encrypt(); vector dencrypt(); private: bool debugg = false; vector str_key; vector > KEY; vector > KEY_SCHEDULE; vector str_io; vector > INPUT, OUTPUT; unsigned int KEY_LENGHT; unsigned int ROUNDS; unsigned int GROUP_SIZE; unsigned int BLOCK_SIZE = 16; //variabile static const unsigned char sbox\[256\]; static const unsigned char isbox\[256\]; static const unsigned char srcon\[256\]; static const unsigned char by\_2\[256\]; static const unsigned char by\_3\[256\]; static const unsigned char by\_9\[256\]; static const unsigned char by\_11\[256\]; static const unsigned char by\_13\[256\]; static const unsigned char by\_14\[256\]; //functii void getKeyFromString(vector&); void gen\_key\_schedule(vector >&); vector x\_xor(vector, vector); vector g(vector&, unsigned int); void subytes(vector >&); void isubytes(vector >&); vector subytesWord(vector&); void debug(vector >&); void dgetInputFromString(vector&); vector > beginEcryptForBlock(vector >&);//beginDEcryptForBlock vector > beginDEcryptForBlock(vector >&); void addRound(vector >&, vector >&); void getWFrmKeySched(unsigned int, vector >&); void shiftRows(vector >&, vector&, vector&, vector&); void ishiftRows(vector >&, vector& , vector& , vector& ); void mixCol(vector >&); void imixCol(vector >&); unsigned int getNextByte(unsigned int, unsigned int); void populateVector4x4(vector >&); }; #endif // AES_H The cpp file , aes.cpp: #include "aes.h" #include #include #include us
  • Bitmap for dialog background questions

    graphics help question
    3
    0 Votes
    3 Posts
    0 Views
    F
    Yes, I found that in a book last night, and it works! Thank you
  • Latency timer settings of communication port

    question com help
    5
    0 Votes
    5 Posts
    0 Views
    U
    MFC reg edit function use.. FTDIBUS - LatencyTimer (DWORD - 16 (default))
  • Ribbon UI, wrong ordering of ribbon elements ?

    design com graphics help question
    1
    0 Votes
    1 Posts
    1 Views
    No one has replied
  • Visual c++ android app development

    c++ android help tutorial
    2
    0 Votes
    2 Posts
    0 Views
    L
    Cwash wrote: eference sheets or any related stuff Google is the tool that will find such information for you.[^].
  • Boost Spirit: Parse an int into a string.

    com data-structures debugging json question
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • I don't quite get this thing I've noticed

    c++ question
    6
    0 Votes
    6 Posts
    0 Views
    L
    The file type recognition is controlled by windows and windows by default doesn't know what a .CPP is or many other types for that matter. More distinctly it doesn't know what program to associate to the file type. That is all done via the File Type Association widget in control panel in windows. The save file dialog is a common control dialog from windows and it is it that is directing the prompt. Usually any good installer for a C++ program makes the changes for association to the file type for you. So either you have a lazy installer for a C++ program or it made the association and you have since broken it. Whatever the case stop complaining about it and go fix it in the File Type Association widget in the windows control panel. If you need assistance an internet search on "File type association on Windows" should give you a multitude of links to work with. It's a bit like complaining when you click on a .BMP file it doesn't open it in the right editor, yeah so go fix it. As an extra helpful tip I can tell you that on the file type association it is useful to select plain text filter onto the .CPP file type. That allows windows searches to go inside your .CPP files on a text search. It is sometimes useful if you have a lot of code directories (like I do) to find a specific block of code if you know something unique about it. You can do a computer wide search for the text string in a .CPP file and it has saved me hours of searching. In vino veritas
  • 0 Votes
    2 Posts
    0 Views
    L
    This will help you to get started, wxWidgets tutorial[^] and for the quick help on things you may post the question here wxWidgets Discussion Forum - Index page[^] This is an active forum like CodeProject but especially for wxwidgets and if you have any doubts regarding wxWidgets you can post your question there and you may get a response quickly. I tried.
  • 0 Votes
    2 Posts
    0 Views
    J
    Without seeing your code this can't be answered. But some possible reasons are: The socket has been closed already The function is called from another thread The socket has been detached You have a statically linked MFC application, created the socket in a secondary thread, and did not call AfxSocketInit in that thread
  • 0 Votes
    1 Posts
    0 Views
    No one has replied
  • UDP Server vs Client

    visual-studio sysadmin
    5
    0 Votes
    5 Posts
    0 Views
    L
    There is no requirement for handshaking on UDP so who is server and who is client is purely notional. In human perspectives it's like two people talking on a CB band and one claiming they are the server and the other the client. The answer is purely in the eyes of the beholder and it is completely meaningless to the operation. It is the EXACTLY the same situation you have two parties chatting using UDP and no-one is in control. Either party can choose a) not to send or b) not to listen and so the idea of who is server and who is client is pointless. Generally the thing that makes that decision is where the data is coming from and going to which has nothing to do with the protocol. However for any situation you gave me I could always argue the server is the other end to the one you choose (you just have to pick the right criteria). To give you an example consider SNMP packets sent from a router back to be logged to a central site (your ISP usually has a display log of your data usage using this). Is the SNMP server the central site or is it the router sending the SNMP packets? Well if you goto the router settings they will generally call themselves the SNMP server. Most likely your SNMP monitor software will also call itself a server because it has the database and is running on an actual server. So which is server and which is client .. well non-one cares it changes nothing :-) In vino veritas