I am working in the kernel space of a project (building in ARM64), and am unable to disable specific warnings for my project. The warning is being treated as an error and will not allow me to compile my project, so you can imagine it is very annoying.
The warning is Error code C4244: '=' conversion from 'ULONG_PTR' to 'ULONG', possible loss of data. I have tried using the #pragma disable warning 4244 however that does not work, I have turned off the "treat warnings as errors" setting in my project, I have "turned off all warnings" in the warnings level project setting.
I seem to have tried everything under the sun and yet I still cannot compile, any solutions? I will post the code throwing the error below so someone might be able to fix, however turning the warning off is just as good :)
ULONG_PTR memory::get_process_id_by_name(PEPROCESS start_process, const char* process_name)
{
PLIST_ENTRY active_process_links;
PEPROCESS current_process = start_process;
do
{
PKPROCESS kproc = (PKPROCESS)current_process;
PDISPATCHER_HEADER header = (PDISPATCHER_HEADER)kproc;
LPSTR current_process_name = (LPSTR)((PUCHAR)current_process + IMAGE_FILE_NAME);
if (header->SignalState == 0 && strcmp(current_process_name, process_name) == 0)
{
return (ULONG_PTR)PsGetProcessId(current_process); //warning occurs here
}
active_process_links = (PLIST_ENTRY)((PUCHAR)current_process + ACTIVE_PROCESS_LINKS_FLINK);
current_process = (PEPROCESS)(active_process_links->Flink);
current_process = (PEPROCESS)((PUCHAR)current_process - ACTIVE_PROCESS_LINKS_FLINK);
} while (start_process != current_process);
return 0;
}