I have a function:
VOID GetOSVersion(PDWORD major, PDWORD minor, PDWORD build)
{
OSVERSIONINFO osver;
ZeroMemory(&osver, sizeof(OSVERSIONINFO));
You are probably not getting an error but a warning (but you might have configured your complier to treat warnings as errors).
If executed, your program will segfault because you are writing to the memory pointed to by them but as they are uninitialized they contain invalid/random addresses.
Possible solution
PDWORD major = new DWORD;
PDWORD minor = new DWORD;
PDWORD build = new DWORD;
assuming PDWORD is defined to be *DWORD.
Do not forget the deletes!
edit: Actually its much more sensible to allocate these on the stack – see user2451677’s answer.