[vlc-commits] [Git][videolan/vlc][master] 3 commits: winvlc: call SetProcessDEPPolicy directly

Steve Lhomme (@robUx4) gitlab at videolan.org
Wed Jul 5 14:37:18 UTC 2023



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
0767bc49 by Steve Lhomme at 2023-07-05T14:11:23+00:00
winvlc: call SetProcessDEPPolicy directly

We build for Win7+, the function is always there.

And no need to define PROCESS_DEP_ENABLE. It's available in mingw-w64 since 4.0.

- - - - -
48155b52 by Steve Lhomme at 2023-07-05T14:11:23+00:00
update: compare the ShellExecuteW result with an intptr_t

Fixes a warning when using the integer variable to store the HINSTANCE.

This code only makes sense when calling ShellExecuteW(), so we move the
code in the same ifdef section.

- - - - -
8f3356f7 by Steve Lhomme at 2023-07-05T14:11:23+00:00
item: add missing static on local function

- - - - -


3 changed files:

- bin/winvlc.c
- src/input/item.c
- src/misc/update.c


Changes:

=====================================
bin/winvlc.c
=====================================
@@ -141,21 +141,8 @@ int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
 
     HeapSetInformation(NULL, HeapEnableTerminationOnCorruption, NULL, 0);
 
-    /* SetProcessDEPPolicy, SetDllDirectory, & Co. */
-    HINSTANCE h_Kernel32 = GetModuleHandle(TEXT("kernel32.dll"));
-    if (h_Kernel32 != NULL)
-    {
-        /* Enable DEP */
-#ifndef PROCESS_DEP_ENABLE
-# define PROCESS_DEP_ENABLE 1
-#endif /* PROCESS_DEP_ENABLE */
-        BOOL (WINAPI * mySetProcessDEPPolicy)( DWORD dwFlags);
-        mySetProcessDEPPolicy = (BOOL (WINAPI *)(DWORD))
-                            GetProcAddress(h_Kernel32, "SetProcessDEPPolicy");
-        if(mySetProcessDEPPolicy)
-            mySetProcessDEPPolicy(PROCESS_DEP_ENABLE);
-
-    }
+    /* Enable DEP */
+    SetProcessDEPPolicy(PROCESS_DEP_ENABLE);
 
     /* Do NOT load any library from cwd. */
     SetDllDirectory(TEXT(""));


=====================================
src/input/item.c
=====================================
@@ -255,7 +255,7 @@ char *input_item_GetMeta( input_item_t *p_i, vlc_meta_type_t meta_type )
     return psz;
 }
 
-const char *input_item_GetMetaExtraLocked( input_item_t *item, const char *psz_name )
+static const char *input_item_GetMetaExtraLocked( input_item_t *item, const char *psz_name )
 {
     vlc_mutex_assert( &item->lock );
     return vlc_meta_GetExtra( item->p_meta, psz_name );


=====================================
src/misc/update.c
=====================================
@@ -737,10 +737,9 @@ static void* update_DownloadReal( void *obj )
 #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
         wchar_t psz_wdestfile[MAX_PATH];
         MultiByteToWideChar( CP_UTF8, 0, psz_destfile, -1, psz_wdestfile, MAX_PATH );
-        answer = (int)ShellExecuteW( NULL, L"open", psz_wdestfile, NULL, NULL, SW_SHOW);
-#endif
-        if(answer > 32)
+        if((intptr_t)(void*)ShellExecuteW( NULL, L"open", psz_wdestfile, NULL, NULL, SW_SHOW) > 32)
             libvlc_Quit(vlc_object_instance(p_udt));
+#endif
     }
 #endif
 end:



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/7a198cd3864b073440e2ed117902a877db7f8477...8f3356f7804ac899a6859689bb04748fd063b0b5

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/7a198cd3864b073440e2ed117902a877db7f8477...8f3356f7804ac899a6859689bb04748fd063b0b5
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list