The segment below is part of a larger function in a larger file. I have reduced it to what I think are the essentials for explaining my current problem.
I am using Visual Studio 2010.
The line with the call to RegConnectRegistryA is causing the compiler to warn me thusly: “warning C4229: anachronism used : modifiers on data are ignored”. That is the only warning or error in the compiler output. The build does succeed, and the executable runs as expected. But I do want to get rid of that warning. (I think it’s been there for many months, to be honest.)
extern "C" __declspec(dllexport) void whoOpsRegistryGetREG_SZ(
LPCSTR szServer,
LPCSTR szKey,
LPCSTR szValue,
char* szReturn,
int iSize)
{
HKEY hKey;
LONG WINAPI lReturn = ::RegConnectRegistryA(
szServer,
HKEY_LOCAL_MACHINE,
&hKey);
}
What I read in other posts leads me to believe that it is somehow related to the #includes. So here they are. If you need the contents of any of the header files in quotes, let me know.
#include "stdafx.h"
#include <windows.h>
#include <initguid.h>
#include <ole2.h>
#include <mstask.h>
#include <msterr.h>
#include <objidl.h>
#include <wchar.h>
#include <stdio.h>
#include <stdarg.h>
#include <lm.h>
#include "whoOpsPrivate.h"
#include "whoOps.h"
#include "jni.h"
#include "whoOps_TaskScheduler.h"
#include "whoOps_ServiceMangler.h"
#include "whoOps_RegistryRaptor.h"
#include "../../cyclOps.h"
Thanks!
Looks to me like the problem is that
WINAPIis actually a calling convention (IIRC it turns out to meanstdcall) so it makes no sense to apply that to the declaration of the variablelResult. I don’t have a Windows development environment handy to test, but I strongly suspect the warning would go away if you removeWINAPI.