Skip to content

Instantly share code, notes, and snippets.

@ismailkocacan
Last active March 31, 2024 13:37
Show Gist options
  • Save ismailkocacan/830c459b5e7b5b392b43f89c68fee017 to your computer and use it in GitHub Desktop.
Save ismailkocacan/830c459b5e7b5b392b43f89c68fee017 to your computer and use it in GitHub Desktop.
LIST_ENTRY - CONTAINING_RECORD
#include <iostream>
#include <Windows.h>
typedef struct tagPERSON {
char name[255];
PLIST_ENTRY link;
} PERSON, * PPERSON;
int main()
{
PPERSON person = new PERSON();
strcpy_s(person->name, "test");
PPERSON record = CONTAINING_RECORD(&person->link, PERSON, link);
std::cout << record->name << "\n";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment