Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Any API call to find OS? Any API to find Subnet Mask?

Posted on 1998-09-24
7
Medium Priority
?
428 Views
Last Modified: 2013-11-20
MFC App. Need to find OS, such as NT, 95, or 98. Any API? Also need to find subnet mask.
0
Comment
Question by:ames
  • 3
  • 3
7 Comments
 
LVL 2

Expert Comment

by:kinkajou
ID: 1322561
To get the version information use GetVersionEx().
0
 
LVL 86

Accepted Solution

by:
jkr earned 600 total points
ID: 1322562
OSVERSIONINFO osviVerInfo;
osviVerInfo.dwOSVersionInfoSize = sizeof ( OSVERSIONINFO);
                  
GetVersionEx ( &osviVerInfo);

switch ( osviVerInfo.dwPlatformId)
{
 case VER_PLATFORM_WIN32_WINDOWS: // Win32 on Win95
      break;
 case VER_PLATFORM_WIN32_NT: // Win32 on WinNT
      break;
 case VER_PLATFORM_WIN32_WIN32sS: // Win32s on Win 3.x
      break;
}

as there's no 'official' API to obtain the netmask, i suggest running 'netstat -r' and analyzing its output
 
                  

0
 
LVL 2

Expert Comment

by:kinkajou
ID: 1322563
That will explain why I couldn't find an API function to get teh subnet mask.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 86

Expert Comment

by:jkr
ID: 1322564
The 'inofficial' location of the subnet mask is HKLM\System\CurrentControlSet\Services\<Network Adapter Name>\Parameters\Tcpip
0
 
LVL 2

Expert Comment

by:kinkajou
ID: 1322565
Cool, thanks. How does one go about getting the <Network Adapter Name>? Is there an API call or say a device look-up?
0
 
LVL 86

Expert Comment

by:jkr
ID: 1322566
See 'HKLM\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Linkage\Route' (binary data). Only valid if 'LanmanWorkstation' is listed first in 'HKLM\SYSTEM\CurrentControlSet\Control\NetworkProvider\Order', alter it if not.
0
 

Author Comment

by:ames
ID: 1322567
There could be multiple network adapters and hence many subnet masks. I used ipconfig or winipcfg. Thanks.
0

Featured Post

[Webinar] Cloud Security

In this webinar you will learn:

-Why existing firewall and DMZ architectures are not suited for securing cloud applications
-How to make your enterprise “Cloud Ready”, and fix your aging DMZ architecture
-How to transform your enterprise and become a Cloud Enabler

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …

963 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question