Commits

Anonymous committed a6813fe

Include error reporting for missing Py_Main

  • Participants
  • Parent commits 4a51e46

Comments (0)

Files changed (1)

 const char bang_python[] = "#!python.exe";
 const char lib_os_py[] = "\\lib\\os.py";
 const char cannot_find_dll_in[] = "Cannot find DLL in ";
+const char Py_Main_str[] = "Py_Main";
 
 int __cdecl
 main(int ac, char **av)
     }
 
     /* get entry points */
-    Py_Main = (void*) GetProcAddress(mainDll, "Py_Main");
-    if (!Py_Main)
-        ExitProcess(1);
+    Py_Main = (void*) GetProcAddress(mainDll, Py_Main_str);
+    if (!Py_Main) {
+        strncpy_s(message, sizeof message, cannot_find, sizeof cannot_find);
+        strcat_s(message, sizeof message, Py_Main_str);
+        goto error;
+    }
 
     /* get paths */
     GetModuleFileName(mainDll, exefile, sizeof(exefile));