473,608 Members | 2,592 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Licencias programa en remoto

Hola buenos dias,

Estoy haciendo un programa en VB 6 que se ejecutara en remoto con Terminal
Server o con CITRIX. Pero tengo que hacer un control de licencias, pensava
en hacer un control por el ordenador que està visualizando el programa. És
posible saber la dirección MAC o el serial del disco duro de ordenador que
esta visualizando el programa? Alguien tiene alguna sugerencia para que solo
el ordenador que se ha licenciado lo pueda ver?

Se agradece cualquier sugerencia,

Saludos cordiales,

SilviaLl.
Dec 7 '07 #1
1 1580
Hello SilviaLl

Your post is 2 times wrong in terms of "Language"

1. The programming language , as this is newgroup has a dotnet prefix it is
not a "classic" group i recomend for VB6
microsoft.publi c.vb.general.di scussion as this group seems to be pretty
active

2. The language in nwich you ask your question newgroup without anny
language identifiers ( nl for dutch , it for italian , es for spanish
etc etc etc ) are so called international groups the comunication language
in these groups is the English language .
if i understand you correctly you need a way to detect the clients starting
your program on a terminal server written in VB6
this might help you as this code can retrieve the client session id

you might license your program for lets say 2 ,4 , 6 , 8 etc etc users if
your program detects more session id`s as it has valid licenses , you can
then display a message
*************** ** Code Start **************
' Portions of this code have been copied from many sources
' including msdn. You are free to use it in any application.
'
' Compiled, modified and tested by Tom Malia and Habib Salim 3/14/2006
' Returns a Terminal Server Session ID and the Computer Name of a Terminal
' Server Client computer. Also use to detect if Terminal Server is running
' on a machine.
'**************
Option Explicit

Const WTS_CURRENT_SER VER_HANDLE = 0&

Private Declare Function WTSEnumeratePro cesses Lib "wtsapi32.d ll" _
Alias "WTSEnumeratePr ocessesA" _
(ByVal hServer As Long, _
ByVal Reserved As Long, _
ByVal Version As Long, _
ByRef ppProcessInfo As Long, _
ByRef pCount As Long) As Long

Private Declare Function WTSQuerySession Information Lib "wtsapi32.d ll" _
Alias "WTSQuerySessio nInformationA" _
(ByVal hServer As Long, _
ByVal SessionId As Long, _
ByVal WTSInfoClass As WTS_INFO_CLASS, _
ByRef ppBuffer As Long, _
pBytesReturned As Long) As Long

Private Declare Sub WTSFreeMemory Lib "wtsapi32.d ll" _
(ByVal pMemory As Long)

Private Declare Sub CopyMemory Lib "kernel32" _
Alias "RtlMoveMem ory" _
(Destination As Any, _
Source As Any, _
ByVal Length As Long)

Private Declare Function GetCurrentProce ssId Lib "kernel32" _
() As Long

Private Type WTS_PROCESS_INF O
SessionId As Long
ProcessId As Long
pProcessName As Long
pUserSid As Long
End Type

Public Enum WTS_INFO_CLASS
WTSInitialProgr am
WTSApplicationN ame
WTSWorkingDirec tory
WTSOEMId
WTSSessionId
WTSUserName
WTSWinStationNa me
WTSDomainName
WTSConnectState
WTSClientBuildN umber
WTSClientName
WTSClientDirect ory
WTSClientProduc tId
WTSClientHardwa reId
WTSClientAddres s
WTSClientDispla y
WTSClientProtoc olType
End Enum

Function TerminalServerC lientID() As String
'MAIN FUNCTION
'Purpose : Returns the name of the Client Machine logged into to TS
'Inputs : N/A
'Outputs : Returns "N/A" if not a terminal server,
' "Unknown/Err" if an error occured
' else returns Computer Name of the client machine

Dim lRetVal As Long
Dim lThisSessionId As Long
Dim lThisProcessId As Long
Dim sBuffer As String
Dim lp As Long
Dim sClientName As String
Dim p As Long

On Error GoTo ErrNotTerminalS erver
'Set Default Value
TerminalServerC lientID = ""
lThisSessionId = 0
sBuffer = String(100, vbNullChar)

'Get the session id for the current user; if session id = 0 this is not
a TS session
lThisSessionId = TerminalServerS essionId

If lThisSessionId Then
'query TS for client Name
lRetVal = WTSQuerySession Information(WTS _CURRENT_SERVER _HANDLE,
lThisSessionId, WTSClientName, p, lp)
If lRetVal Then
'The client name has been passed to the buffer - now get it
back
Debug.Print GetStringFromLP (p)
sClientName = GetStringFromLP (p)
'sClientName = GetStringFromLP (sBuffer)- this causes a type
mismatch

Debug.Print sClientName
TerminalServerC lientID = sClientName
Else
TerminalServerC lientID = "UNKNOWN/ERR"
End If
Else
'This is not a TS Session
TerminalServerC lientID = "N/A"
End If

Exit Function

ErrNotTerminalS erver:
Debug.Print Err.Number; Err.Description
TerminalServerC lientID = "UNKNOWN/ERR"

End Function

Function TerminalServerS essionId() As String
'Purpose : Returns a terminal server session ID
'Inputs : N/A
'Outputs : Returns "0" if not a terminal server, else returns the
terminal server session ID.

Dim lRetVal As Long
Dim lCount As Long
Dim lThisProcess As Long
Dim lThisProcessId As Long
Dim lpBuffer As Long
Dim lp As Long
Dim udtProcessInfo As WTS_PROCESS_INF O

On Error GoTo ErrNotTerminalS erver
'Set Default Value
TerminalServerS essionId = "0"
lThisProcessId = GetCurrentProce ssId
lRetVal = WTSEnumeratePro cesses(WTS_CURR ENT_SERVER_HAND LE, 0&, 1,
lpBuffer, lCount)
If lRetVal Then
'Successful
lp = lpBuffer
For lThisProcess = 1 To lCount
CopyMemory udtProcessInfo, ByVal lp, LenB(udtProcess Info)
If lThisProcessId = udtProcessInfo. ProcessId Then
TerminalServerS essionId = CStr(udtProcess Info.SessionId)
Exit For
End If
lp = lp + LenB(udtProcess Info)
Next
'Free memory buffer
WTSFreeMemory lpBuffer
End If

Exit Function

ErrNotTerminalS erver:
'The machine is not a Terminal Server
On Error GoTo 0
End Function

Private Function GetStringFromLP (ByVal StrPtr As Long) As String
Dim b As Byte
Dim tempStr As String
Dim bufferStr As String
Dim Done As Boolean
Done = False

Do
' Get the byte/character that StrPtr is pointing to.
CopyMemory b, ByVal StrPtr, 1
If b = 0 Then ' If you've found a null character, then you're done.
Done = True
Else
tempStr = Chr$(b) ' Get the character for the byte's value
bufferStr = bufferStr & tempStr 'Add it to the string
StrPtr = StrPtr + 1 ' Increment the pointer to next byte/char
End If

Loop Until Done
GetStringFromLP = bufferStr

End Function


hth

Michel


"SilviaLl" <sllado@[NONECESARI]gmailDOTcomschr eef in bericht
news:uO******** ******@TK2MSFTN GP02.phx.gbl...
Hola buenos dias,

Estoy haciendo un programa en VB 6 que se ejecutara en remoto con Terminal
Server o con CITRIX. Pero tengo que hacer un control de licencias, pensava
en hacer un control por el ordenador que està visualizando el programa. És
posible saber la dirección MAC o el serial del disco duro de ordenador que
esta visualizando el programa? Alguien tiene alguna sugerencia para que
solo el ordenador que se ha licenciado lo pueda ver?

Se agradece cualquier sugerencia,

Saludos cordiales,

SilviaLl.

Dec 7 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1699
by: Gomez,Martin | last post by:
como puedo crear un programa: que calcule la latitud, y altitud. como puedo ingresar graficos que se muevan a 360ª y se puedan acercar y alejar por medio de un icono o flecha. saldarriagajuan@latinmail.com Tks...........
0
2049
by: Programas de email | last post by:
Convidamos você a experimentar o Magic Seven, o melhor programa de envio de emails para listas de contatos. Com o Magic Seven você pode enviar emails personalizados e com recursos multimídia, além de ser o programa mais rápido e confiável do mercado. O Magic Seven está no mercado há mais de 5 anos, já estando na sua versão 5. É um produto em
1
2954
by: Liber | last post by:
Utilizando .Net, como puedo obtener la dirección ip o el nombre del cliente remoto que está conectado por Terminal Service a un Servidor de Terminal ? En el Terminal Servide Manager me muestra el nombre del cliente remoto, o sea del equipo remoto, pero no se como obtenerlo utilizando C# .Net. gracias.
0
5375
by: alex,ocoro | last post by:
PROGRAMAS UTILIZADOS PARA HACKEAR NOMBRE DEL PROGRAMA DESCRIPCIÓN S.O. Cracker Jack 1.4 Descodificador de Passwords de Unix. Inglés.
2
1200
by: =?Utf-8?B?S2V2aW4=?= | last post by:
I have autogeneratecolumns set to yes but the columns I am bound to to are not in the collection (using c#). How would I access them to set their wrap property to false. Please help I am stumpped on this one... Thx. Kevin
5
1135
by: diegososa | last post by:
I have this code inside a function: try: for linea in subprocess.Popen(comando, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True).stdout: req = urllib2.Request(URL, "&mac_addr=" + mac_addr + " &sampled_time=" + sampled_time + " &line_data=" + linea) ret = urllib2.urlopen(req).read() except (urllib2.URLError, httplib.HTTPException): logger.error('Error de comunicación con el...
0
1938
by: Ranger | last post by:
TRANSFORME R$12,00 EM R$12.000,00 SÓ VAI TOMAR UM POUCO DO SEU TEMPO E VC Ñ VAI SE ARREPENDER ACREDITE!!! LEIA COM ATENÇÃO. MÉTODO APROVADO PELA REVISTA EXAME Você já imaginou ganhar até R$ 12.000,00 ou mais, em pouco tempo? Acha impossível? Leia este artigo e comemore!!! Eu encontrei esta mensagem em um site e decidi tentar. Pouco curioso por natureza, continuei lendo. Logo abaixo, o texto apresenta uma
0
2497
by: Ranger | last post by:
TRANSFORME R$12,00 EM R$12.000,00 SÓ VAI TOMAR UM POUCO DO SEU TEMPO E VC Ñ VAI SE ARREPENDER, ACREDITE!!! MÉTODO APROVADO PELA REVISTA EXAME Você já imaginou ganhar até R$ 12.000,00 ou mais, em pouco tempo? Acha impossível? Leia este artigo e comemore!!! Eu encontrei esta mensagem em um site e decidi tentar. Pouco curioso por natureza, continuei lendo. Logo abaixo, o texto apresenta uma
0
7998
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8491
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8470
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8329
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6813
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6010
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
3959
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4022
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1327
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.