From 2a6909497eba9ed68751de79bc8978aaa70cdfdd Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Wed, 22 Aug 2018 10:12:40 +0000 Subject: [PATCH] TestEIn : - aggiunto controllo debug attivo su versione release mediante funzione CheckRemoteDebuggerPresent. --- Form1.vb | 13 ++++++++++--- GenInterface.vb | 29 +++++++++++++++++------------ 2 files changed, 27 insertions(+), 15 deletions(-) diff --git a/Form1.vb b/Form1.vb index 7f45b5a..7ea860f 100644 --- a/Form1.vb +++ b/Form1.vb @@ -124,6 +124,15 @@ Public Class Form1 (ChrW(97 - 1 + My.Application.Info.Version.Build)).ToString() & My.Application.Info.Version.Revision.ToString() EgtInit(m_nDebug, sLogFile, sLogMsg) + ' Se versione realease, verifico presenza debugger +#If Not Debug Then + Dim bDebuggerPresent As Boolean = False + CheckRemoteDebuggerPresent(System.Diagnostics.Process.GetCurrentProcess().Handle, bDebuggerPresent) + If bDebuggerPresent Then + EgtOutLog("Error in EgtCheckInit") + End + End If +#End If ' Leggo direttorio dei messaggi (se manca uso direttorio di configurazione) Dim sMsgDir As String = String.Empty If GetPrivateProfileString(S_GENERAL, K_MESSAGESDIR, "", sMsgDir, m_sIniFile) = 0 Then @@ -133,9 +142,7 @@ Public Class Form1 Dim sMsgFile As String = String.Empty GetPrivateProfileString(S_GENERAL, K_MESSAGES, "", sMsgFile, m_sIniFile) Dim sMsgFilePath As String = sMsgDir & "\" & sMsgFile - If Not EgtLoadMessages(sMsgFilePath) Then - EgtOutLog("Error in EgtLoadMessages") - End If + If Not EgtLoadMessages(sMsgFilePath) Then EgtOutLog("Error in EgtLoadMessages") ' Leggo e imposto livello utilizzatore m_nUserLevel = GetPrivateProfileInt(S_GENERAL, K_USERLEVEL, 1, m_sIniFile) ' imposto dir font Nfe e font default diff --git a/GenInterface.vb b/GenInterface.vb index 91497ee..6bc6dcd 100644 --- a/GenInterface.vb +++ b/GenInterface.vb @@ -45,7 +45,7 @@ Public Function GetPrivateProfileString( lpAppName As String, lpKeyName As String, lpDefault As String, - ByRef lpString As String, + ByRef lpString As String, lpFileName As String) As Integer Dim sb As New StringBuilder(1024) Dim nRet As Integer = GetPrivateProfileString(lpAppName, lpKeyName, lpDefault, sb, sb.Capacity, lpFileName) @@ -56,7 +56,7 @@ End Function Public Function GetPrivateProfileColor( lpAppName As String, lpKeyName As String, - ByRef Col As Color3d, + ByRef Col As Color3d, lpFileName As String) As Boolean Dim sVal As String = String.Empty GetPrivateProfileString(lpAppName, lpKeyName, "", sVal, lpFileName) @@ -76,8 +76,8 @@ End Function Public Function GetPrivateProfileZoomWin( lpAppName As String, lpKeyName As String, - ByRef bOutline As Boolean, - ByRef Col As Color3d, + ByRef bOutline As Boolean, + ByRef Col As Color3d, lpFileName As String) As Boolean Dim sVal As String = String.Empty GetPrivateProfileString(lpAppName, lpKeyName, "", sVal, lpFileName) @@ -96,11 +96,11 @@ End Function Public Function GetPrivateProfileWinPos( lpAppName As String, lpKeyName As String, - ByRef nFlag As Integer, - ByRef nLeft As Integer, - ByRef nTop As Integer, - ByRef nWidth As Integer, - ByRef nHeight As Integer, + ByRef nFlag As Integer, + ByRef nLeft As Integer, + ByRef nTop As Integer, + ByRef nWidth As Integer, + ByRef nHeight As Integer, lpFileName As String) As Boolean Dim sVal As String = String.Empty GetPrivateProfileString(lpAppName, lpKeyName, "", sVal, lpFileName) @@ -147,7 +147,7 @@ Public Function GetSystemMenu(hWnd As IntPtr, bRevert As Boolean) As IntPtr End Function Public Function AppendMenu(hMenu As IntPtr, uFlags As Integer, - uIDNewItem As Integer, lpNewItem As String) As Boolean + uIDNewItem As Integer, lpNewItem As String) As Boolean End Function Public Const MF_STRING As UInt32 = &H0 Public Const MF_SEPARATOR As UInt32 = &H800 @@ -163,10 +163,10 @@ Public Enum SW As Integer SHOWMAXIMIZED = 3 RESTORE = 9 End Enum - _ + Public Function GetWindowLong(hWnd As IntPtr, nIndex As Integer) As Integer End Function - _ + Public Function SetWindowLong(hWnd As IntPtr, nIndex As Integer, dwNewLong As Integer) As Integer End Function Public Const GWL_STYLE As Integer = -16 @@ -188,5 +188,10 @@ Public Function PathCompactPathEx( ) As Boolean End Function +'-------------------------------- Check Debugger ---------------------------------------------------- + +Public Function CheckRemoteDebuggerPresent(hProcess As IntPtr, ByRef fResult As Boolean) As Boolean +End Function + End Module