TestEIn :

- aggiunto controllo debug attivo su versione release mediante funzione CheckRemoteDebuggerPresent.
This commit is contained in:
Dario Sassi
2018-08-22 10:12:40 +00:00
parent 9ac3a9d7d2
commit 2a6909497e
2 changed files with 27 additions and 15 deletions
+10 -3
View File
@@ -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
+17 -12
View File
@@ -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
<DllImport("user32.dll", CharSet:=CharSet.Auto)>
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
<DllImport("user32.dll", SetLastError:=True)> _
<DllImport("user32.dll", SetLastError:=True)>
Public Function GetWindowLong(hWnd As IntPtr, nIndex As Integer) As Integer
End Function
<DllImport("user32.dll")> _
<DllImport("user32.dll")>
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 <MarshalAs(UnmanagedType.Bool)> Boolean
End Function
'-------------------------------- Check Debugger ----------------------------------------------------
<DllImport("kernel32.dll", SetLastError:=True, CharSet:=CharSet.Unicode)>
Public Function CheckRemoteDebuggerPresent(hProcess As IntPtr, ByRef fResult As Boolean) As Boolean
End Function
End Module