|
The following snippet does what you want, I guess:
char szConnection[]=...;
char szProxy[]=...;
INTERNET_PER_CONN_OPTION_LIST List;
INTERNET_PER_CONN_OPTION Option[1];
unsigned long nSize = sizeof(INTERNET_PER_CONN_OPTION_LIST);
Option[0].dwOption = INTERNET_PER_CONN_PROXY_SERVER;
Option[0].Value.pszValue = (LPSTR)szProxy;
List.dwSize = sizeof(INTERNET_PER_CONN_OPTION_LIST);
List.pszConnection = (LPSTR)szConnection;
List.dwOptionCount = 1;
List.dwOptionError = 0;
List.pOptions = Option;
InternetSetOption(NULL, INTERNET_OPTION_PER_CONNECTION_OPTION, &List, nSize); The proxy is set for all protocols within the connection (HTTP, FTP, etc.) Hope this helps.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I need to understand Net Bios Names please.
A static NetBIOS name mapping consists of a NetBIOS name from 1 - 15 characters, a name type from 0 - 255, and a corresponding IP address. TAS resolves a NetBIOS name by first searching the list of static NetBIOS names and, failing that, broadcasting a query for the desired name. Augment name resolution to effectively cross routers by using the Enterprise Name Service or Windows Internet Naming Service.
Best Wishes,
ez_way
|
|
|
|
|
Hi
Look at this
http://www.microsoft.com/windows2000/en/server/help/default.asp?url=/windows2000/en/server/help/sag_TCPIP_und_nr_NetBIOS.htm
and
http://support.microsoft.com/default.aspx?scid=http://support.microsoft.com:80/support/kb/articles/q163/4/09.asp&NoWebContent=1
It will say the story.
Best Regards,
A.Ilamparithi
|
|
|
|
|
Thanks will seek the url's now!
Here what I have so far from an article in 1995 for the last two digit sufix.
Thanks again
Name Number(h) Type Usage
--------------------------------------------------------------------------
<computername> 00 U Workstation Service
<computername> 01 U Messenger Service
<\\--__MSBROWSE__> 01 G Master Browser
<computername> 03 U Messenger Service
<computername> 06 U RAS Server Service
<computername> 1F U NetDDE Service
<computername> 20 U File Server Service
<computername> 21 U RAS Client Service
<computername> 22 U Microsoft Exchange Interchange(MSMail
Connector)
<computername> 23 U Microsoft Exchange Store
<computername> 24 U Microsoft Exchange Directory
<computername> 30 U Modem Sharing Server Service
<computername> 31 U Modem Sharing Client Service
<computername> 43 U SMS Clients Remote Control
<computername> 44 U SMS Administrators Remote Control
Tool
<computername> 45 U SMS Clients Remote Chat
<computername> 46 U SMS Clients Remote Transfer
<computername> 4C U DEC Pathworks TCPIP service on
Windows NT
<computername> 42 U mccaffee anti-virus
<computername> 52 U DEC Pathworks TCPIP service on
Windows NT
<computername> 87 U Microsoft Exchange MTA
<computername> 6A U Microsoft Exchange IMC
<computername> BE U Network Monitor Agent
<computername> BF U Network Monitor Application
<username> 03 U Messenger Service
<domain> 00 G Domain Name
<domain> 1B U Domain Master Browser
<domain> 1C G Domain Controllers
<domain> 1D U Master Browser
<domain> 1E G Browser Service Elections
<inet~services> 1C G IIS
<is~computer name=""> 00 U IIS
<computername> [2B] U Lotus Notes Server Service
IRISMULTICAST [2F] G Lotus Notes
IRISNAMESERVER [33] G Lotus Notes
Forte_$ND800ZA [20] U DCA IrmaLan Gateway Server Service
Best Wishes,
ez_way
|
|
|
|
|
Good information now may I ask a few question please.
In the following URL
http://www.microsoft.com/windows2000/en/server/help/default.asp?url=/windows2000/en/server/help/sag_TCPIP_und_nr_NetBIOS.htm
I found in part the following>
Gateway Server Service
Computers running Windows 2000 are B-node by default and become H-node when they are configured with a WINS server. Windows 2000 can also use a local database file called Lmhosts to resolve remote NetBIOS names. The Lmhosts file is stored in the systemroot\System32\Drivers\Etc folder. For more information, see TCP/IP database files
I am running XP Home and have found the following information.
Under windows/system32/drivers/etc
file name type
host file
host.ics ics file
imhost.sam sam
networks file
quotes file
services file
protocols file
I am not using wins server so I might assume I am running in B-Mode.
How does one know which mode one is running in?
How does one retrieve the type of protocol any computer might be running?
How do I retrieve the netbios name for any computer.
Once this is done may I get the MAC address by polling with the netbios name?
Best Wishes,
ez_way
|
|
|
|
|
Hi,
Have a look at this site...
http://www.inetcat.org/software/nbtscan.html
I think it will answer ur questions.
Best Regards,
A.Ilamparithi
|
|
|
|
|
Will using UuidCreateSequential_t return the correct MAC address?
GUID uuid;
typedef RPC_STATUS (CALLBACK* UuidCreateSequential_t)(UUID*);
|
|
|
|
|
hi check this one out....
// GetMACUuid.cpp : Defines the entry point for the console application.
//
// Author: Khalid Shaikh [Shake@ShakeNet.com]
// Date: April 5th, 2002
//
// This program fetches the MAC address of the localhost by creating a UUID
// and obtaining the IP address through that
//
// Prewindows 2000 one should replace the function below
// UuidCreateSequential with UuidCreate
// Microsoft decided that it was not wise to put the MAC address in the UUID
// hence changed the algorithm in Windows 2000 and later to not include it.
//
// Supported in Windows NT/2000/XP
// Supported in Windows 95/98/Me
//
// Supports single NIC card.
#include "stdafx.h"
#include <windows.h>
#include <rpc.h>
#include <rpcdce.h>
#pragma comment(lib, "rpcrt4.lib")
// Prints the MAC address stored in a 6 byte array to stdout
static void PrintMACaddress(unsigned char MACData[])
{
printf("MAC Address: %02X-%02X-%02X-%02X-%02X-%02X\n",
MACData[0], MACData[1], MACData[2], MACData[3], MACData[4], MACData[5]);
}
// Fetches the MAC address and prints it
static void GetMACaddress(void)
{
unsigned char MACData[6];
UUID uuid;
UuidCreateSequential( &uuid ); // Ask OS to create UUID
for (int i=2; i<8; i++) // Bytes 2 through 7 inclusive are MAC address
MACData[i - 2] = uuid.Data4[i];
PrintMACaddress(MACData); // Print MAC address
}
int _tmain(int argc, _TCHAR* argv[])
{
GetMACaddress(); // Obtain MAC address of adapters
return 0;
}
Best Regards,
A.Ilamparithi
|
|
|
|
|
I'm not sure exactly what you're trying to accomplish but I'm familiar with NetBios names. It sounds like you're overcomplicating it! But isn't that usually the case?
A Netbios name is basically just the short name of a computer, whereas the DNS name includes the short name plus the domain suffix's. For example, if your computer name is BOB and you're in the Microsoft domain, then your Netbios name is "BOB" and your fully qualified DNS hostname would be bob.microsoft.com.
If you go to a command prompt and enter "hostname", it will return your NetBios name. You can use "nbtstat -c" to view a list of Netbios names that are in your local cache. Throw a "/?" switch to see how to refresh, clear, and reload your Netbios cache. When a computer starts up, it will typically attempt to fill your cache with netbios names that is needed to map drives, log into domains, run login scripts, locate exchange servers on the LAN etc., first through your local cache (LMHOST), then WINS (which is nothing more than a Netbios to IP name resolver), router tables if they're set up for it, and then by broadcasting. This is how networks are usually set up by default and where the node types come into play. You can modify the node type (broadcast, hybrid, etc.) to tell your computer in which order you'd like to resolve Netbios names and/or whether or not you want to use those various methods of resolution.
As long as DNS is set up properly, there should be no need to modify the LMHOST file on a workstation. The only time you should need to modify this file is in cases between two domain controllers where you've established a trust relationship, or for "tricking" a workstation into locating specific domain controllers for authentication to an NT domain (or Active Directory" by hardcoding it into the local cache for purposes of load balancing. Or if WINS is hosed, or your router tables are refreshing too quickly, etc., but again, on a well-planned network, you shouldn't need to make adjustments to the LMHOST file and doing so can result in an maintenance nightmare for network administrators. They'll sometimes use this file to get someone connected to a network resource as a quick-fix, rather than correcting the source of the problem, which will usually lead to even more problems later.
Hope that helps. If I can answer anything more specific, let me know.
Cheers,
Don
|
|
|
|
|
Wow! Great information! Thank is just what I needed. Microsoft White Paper 1999 shows that you must pad the NetBiosName to length of 20 excluding a \0
Show I ran nbtstat -n on my new HP and it returned the following.
Local Area Connection:
Node IpAddress: [68.116.126.8] Scope Id: []
NetBIOS Local Name Table
Name Type Status
---------------------------------------------
HP2003 <00> UNIQUE Registered
HP2003 <20> UNIQUE Registered
WORKGROUP <00> GROUP Registered
WORKGROUP <1E> GROUP Registered
WORKGROUP <1D> UNIQUE Registered
..__MSBROWSE__.<01> GROUP Registered
So what is the proper way to obtain the MAC address of a system?
may I get the MAC address by?:
In the fine codeproject article "Get MAC Address" by Ryszard Krakowiak http://www.codeproject.com/internet/getmac.asp?target=MAC
shows in part:
typedef struct _ASTAT_
{
ADAPTER_STATUS adapt;
NAME_BUFFER NameBuff[30];
} ASTAT, * PASTAT;
CString GetMacAddress(CString sNetBiosName)
{
ASTAT Adapter;
NCB ncb;
UCHAR uRetCode;
memset(&ncb, 0, sizeof(ncb));
ncb.ncb_command = NCBRESET;
ncb.ncb_lana_num = 0;
uRetCode = Netbios(&ncb);
memset(&ncb, 0, sizeof(ncb));
ncb.ncb_command = NCBASTAT;
ncb.ncb_lana_num = 0;
sNetBiosName.MakeUpper();
FillMemory(ncb.ncb_callname, NCBNAMSZ - 1, 0x20);
strcpy((char *)ncb.ncb_callname, (LPCTSTR) sNetBiosName);
ncb.ncb_callname[sNetBiosName.GetLength()] = 0x20;
ncb.ncb_callname[NCBNAMSZ] = 0x0;
ncb.ncb_buffer = (unsigned char *) &Adapter;
ncb.ncb_length = sizeof(Adapter);
uRetCode = Netbios(&ncb);
CString sMacAddress;
if (uRetCode == 0)
{
sMacAddress.Format(_T("%02x%02x%02x%02x%02x%02x"),
Adapter.adapt.adapter_address[0],
Adapter.adapt.adapter_address[1],
Adapter.adapt.adapter_address[2],
Adapter.adapt.adapter_address[3],
Adapter.adapt.adapter_address[4],
Adapter.adapt.adapter_address[5]);
}
return sMacAddress;
}
where another fine article uses the GUID for obtaining the MAC address.
CString CTinyMacDlg::TryMac()
{
CString strReturn;
GUID uuid;
// In Win2k or higher, CoCreateGuid no longer returns a mac address, but UuidCreate
// Sequential does.
typedef RPC_STATUS (CALLBACK* UuidCreateSequential_t)(UUID*);
// This doesn't exist Pre win2k,
// in that case it uses CoCreateGuid (which will fail in 2k+) - mc
HMODULE hRpcrt4 = LoadLibrary("rpcrt4.dll"); // Attempt to load RPCRT4.DLL
if(hRpcrt4)
{
UuidCreateSequential_t fpUuidCreateSequential;
fpUuidCreateSequential = (UuidCreateSequential_t)
GetProcAddress(hRpcrt4, "UuidCreateSequential");
// Attempt dynamic load of UuidCreateSequential c
if(fpUuidCreateSequential)
{
// Create Sequential UUID for determination of MAC Address
fpUuidCreateSequential(&uuid);
}
else
{ // OS Doesn't support UuidCreateSequential, so fall back on CoCreateGuid
CoCreateGuid(&uuid);
}
FreeLibrary(hRpcrt4);
}
else
{ // OS Doesn't support UuidCreateSequential, so fall back on CoCreateGuid
CoCreateGuid(&uuid);
}
// Now Format The adapter address - mc
strReturn.Format("%2.2X-%2.2X-%2.2X-%2.2X-%2.2X-%2.2X",
uuid.Data4[2],
uuid.Data4[3],
uuid.Data4[4],
uuid.Data4[5],
uuid.Data4[6],
uuid.Data4[7]);
return strReturn;
}
My next question is which is thr proper way or is there another way?
Thank you so very much for your thoughful response.
Marty
Best Wishes,
ez_way
|
|
|
|
|
Are you trying to do this programmatically or do you just want to find out the MAC address of your network adapter? I haven't done this programmatically but the first one looks like the best solution, which was basically just copied from this Microsoft link:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/netbios/netbios_8d82.asp[^]
Note that a MAC address is specific to a network adapter and not the system itself, so if you have more than one NIC, you'll have more than one MAC address, so you'll want to make sure that you're obtaining the correct one and it could change should someone replace the NIC.
If you're just looking for a MAC address on your computer, from a command prompt, type "ipconfig /all" and it will list information for all of your NIC's. The MAC address is the "Physical Address".
Cheers,
Don
|
|
|
|
|
Ok great I am trying to do it programmatically so I will continue with your great advice.
Thanks for helping me, I thank you so much!
Marty
Best Wishes and Happy Turkey Day,
ez_way
|
|
|
|
|
By using CreateProcess, I can invoke a new application, and get the process id for the newly created process, but how can I get the handle of the application's main window?
Thanks!!!
|
|
|
|
|
I quick look at MSDN did not produce the answer, but there is a function (I forget the name) that will give you a handle to a window based on the name of the window (name on title bar). Take a look around codeproject, codeguru, programmers haven, etc... There are articles that explane how to do what you want, if not directly then indirectly. For instance, there are programs that allow you to point at a window with the mouse and get all the information you want about it (up to and including capturing it to a bitmap file). I know, they use a function that gets the window handle based on given coordinates. Since you already have the process ID, you should be walk its' contents some how.
Well I hope this gave you some idea in which direction to look.
Good luck!
INTP
|
|
|
|
|
Thank you very much! And the function you mentioned is FindWindow().
|
|
|
|
|
Is it possible to get a function pointer which is 100% the original pointer?
I know that GetWindowLong() will return the function pointer, but I need a gaurunatee that the pointer I extract is the opriginal pointer not a subclassed function pointer.
I don't have the option of saving the original pointer when the window is first created, like inside WinMain() and after RegisterClassEx() ...so thats out of the question...
Is there anyway I can get the previous function pointer from the current pointer???
[EDIT]
DefWindowProc() I don't think is what I want.
Unless it calls the original WndProc that developers assigned to WNDCLASS when they created the window. I need the function pointer to the function which will handle not just generic window messages...
Does DefWindowProc() actually call the function specified by programmer or does it just handle message generically?
[/EDIT]
Hope I made my dilema clear...
Cheers
The word of the day is legs, let's go back to my house and spread the word
|
|
|
|
|
If you know the what the name of the origanal function was then you already have a pointer to it. As for getting the previous pointer from the current pointer, I dought it. You might take a look at one of Jeffrey Richters' books, there the best books on Windows programing I have ever read (Hey man, when microsoft wants there employees trained the call Jeffrey).
INTP
|
|
|
|
|
No I wouldn't have known the name of the original procedure...becuz of what it was I was trying to do...however I have just read an article that cleared everything up...I can't accomplish what I wanted to using the techniques I was planning on using...
Sux when that happens...
Ah well
Cheers
p.s-I've read alot "about" Richter books lately...I really should go grab one...
The word of the day is legs, let's go back to my house and spread the word
|
|
|
|
|
|
Try the following :
either :
- use GetClassLongPtr(hWnd, GCLP_WNDPROC) which should not be changed when a window is subclassed as subclassing is window specific, and this is class specific.
or,
- get window classname
- create a new hidden instance of that window class
- get wndproc of new window
- this should be the same, original, wndproc for all instances of window class
- delete hidden window
...cmk
Save the whales - collect the whole set
|
|
|
|
|
Please let me know how to access the ActiveX control(from 3rd party developed in VisualBasic) from Visual C++ ????
If possible let me know the sample code.
|
|
|
|
|
The language used to write an ActiveX control does not matter.
Look up ActiveX in MSDN. The sub catagory "what is an ActiveX control" points you totorials on ActiveX controls. Also, search codeproject and its' associated web sites for articles on the subject.
INTP
|
|
|
|
|
I am trying to build a number of straight C++ projects that were made with VC6 and I am getting a gazillion template errors. I tried specifically with VS.NET 2003 and it was a horror show of hundreds of compile-time template problems, when I switched to VS.NET (version 1) I was able to fix a mere few errors and it built fine.
Why the big discrepency? Is there a guide of FAQ on common issues for porting VC6 "compliant" template code to VS.NET 2003?
If not there should be because this is a royal pain in the you know what.
Any pointers are appreciated.
|
|
|
|
|
There was a huge leap in C++ standards conformance from VC6 to .NET. If you're having a lot of trouble, it means the original code was not standard conformant.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
Ok, that much I understand. How does one go about fixing it? Also, its interesting that I got it built easily in VS.NET but it was so much of a problem with VS.NET 2003.
|
|
|
|
|