windows version

Hello,

I want write an activation code somewhere in the registry (I am new on this 
field), and I want:

1- identifiy the SO (windows XP 32-bit, 64-bit, win 7, 32-bit, 64-bit,... 
win 10 64-bit, 32-bit
2- check if I have the permission to write in the registry

how can I accompish the two tasks above ?

thank you in advance.
0
Paolo
8/10/2015 5:55:43 PM
embarcadero.delphi.general 4258 articles. 0 followers. Follow

2 Replies
637 Views

Similar Articles

[PageSpeed] 36

Paolo wrote:

> I want write an activation code somewhere in the registry (I am new on
> this field)

Apparently, because that is not a very secure place to store activation codes.

> and I want:
> 
> 1- identifiy the SO (windows XP 32-bit, 64-bit, win 7, 32-bit,
> 64-bit,... win 10 64-bit, 32-bit

If your app is 64bit, it can run only on a 64bit system.  Easy to detect 
- if your app is running, the OS is 64bit.

If your app is 32bit, it can run on a 32bit or a 64bit system (in the latter 
case, only if WOW64 is installed).  In this situation, to differentiate between 
a 32bit and 64bit system, you can use GetProcAddress() to check if GetNativeSystemInfo() 
is available and then call it if so, otherwise call GetSystemInfo() instead. 
 They will tell you if the system's CPU architecture is 32bit or 64bit.  
Alternatively, you can use IsWow64Process() to check if your app is running 
inside of WOW64 or not.

Getting the OS version is trickier.  Prior to Windows 8.1, you can reliably 
use GetVersionEx() to get the OS version (Delphi calls that function at startup 
and populates the global Win32MajorVersion, Win32MinorVersion, and Win32Platform 
variables in the SysUtils unit).  However, in Windows 8.1 onwards, GetVersionEx() 
lies if your app is not explicitly manifested as being compatible with the 
OS versions you are running your app on.  Without such a manifest, GetVersionEx() 
falls back to reporting Windows 8 even if you are not actually runnning on 
Windows 8.  In Windows 8.1, you can get around that issue by using VerifyVersionInfo() 
instead, but that function was changed in Windows 10 to rely on a manifest 
as well.  In Windows 10 (and earlier), there are some alternatives that work 
without manifests, such as RtlGetVersion() in ntdll.dll, and NetServerGetInfo() 
in netapi32.dll (with its level set to 101).  There are other options available 
as well, like WMI.  See the following discussion for more details:

How to detect true Windows version
http://stackoverflow.com/questions/57124/

(one of the answers is mine).

> 2- check if I have the permission to write in the registry

The simpliest way is to just attempt the write normally and check if it fails. 
 Checking permissions manually is very difficult to get right, so don't even 
try if you can avoid it.  Let the OS handle it for you.

-- 
Remy Lebeau (TeamB)
0
Remy
8/10/2015 8:41:01 PM
"Paolo Valle" wrote on Mon, 10 Aug 2015 10:55:43 -0700:

> 1- identifiy the SO (windows XP 32-bit, 64-bit, win 7, 32-bit, 64-bit,... 
> win 10 64-bit, 32-bit

Remy gave a comprehensive reply to this, but I will add that if you
want the true OS build number and don't want to be worried about
future changes to how Windows reports its version info, you can grab
the version info off of kernel32.dll to know with certainty.

That said, I would only use that version string for informational
purposes -- don't let your code make decisions on it.  There are good
reasons why Microsoft changed how version strings are reported -- the
only down side is the confusion that appears if your application
reports it to the user or in a bug report.

-- 
Brandon Staggs
StudyLamp Software LLC
http://www.studylamp.com
0
Brandon
8/11/2015 9:47:54 PM
Reply:

Similar Artilces:

You are redirected to Windows Update version 4 when you try to connect to Windows Update version 5
[can anyone spot the flaw in these instructions?] You are redirected to Windows Update version 4 when you try to connect to Windows Update version 5 http://support.microsoft.com/?kbid=883828 SYMPTOMS When you try to connect to Windows Update version 5, you are redirected to Windows Update version 4. CAUSE This problem occurs if your Microsoft Internet Explorer security settings are configured to prevent ActiveX controls from running. RESOLUTION To resolve this problem, follow these steps: 1. Click Start, click Run, type inetcpl.cpl, and then click OK. 2. Click the Sec...

ASA-Versions an Windows-Versions
Hi I have some questions to ASA-Versions and Windows-Versions: Is ASA 9.0.1 compatible to Windows Vista? Will it be compatible to Windows 2008? I suppose, ASA 10.0.1 is compatible to Windows Vista? Will it also be compatible to Windows 2008? If, not, will there be an ASA 10.x, that is compatible to Windows 2008? When will the ASA 11 come? Thanks in advance, Alex Alex Wittler wrote: > Hi > > I have some questions to ASA-Versions and Windows-Versions: > > Is ASA 9.0.1 compatible to Windows Vista? Will it be compatible to Windows > 2008? >...

WHICH Delphi XE version is the most stable for windows desktop development? [Edit]
Hello there, I'm starting with delphi, because I'm nedding a whole environment letting me to develop some apps for windows desktop environment, but reading since some time ago about the topic, I'm not clear at all which delphi version(xe2,xe3,xe4,xe5) would be the best( the more stable, reliable, with less bugs, smaller .exe compilation, in broad terms the one with better performance) for desktop developing, I'm not interested in mobile develop yet, just native windows developing. Guess most of my apps wi ll be the typical app with local database, use of 3rd components and acc...

Windows Version vs. Linux Version
I've noticed one minor difference between the Win and Linux versions. In the Windows version, if I click on the navigation bar's url part the entire contents of the bar are selected and typing clears the selection and replaces it with whatever I type. In the Linux version on my dual boot machine, this doesn't happen. Nothing is highlighted and whatever I type gets appended to whatever is already there. Is this the way it is supposed to be? No big deal -- just curious. Thank you Jack Gillis wrote: > I've noticed one minor difference between the Win...

Diff between windows version and linux version
In the windows version, I can leave messages on server "until I delete them", but the linux version says "until I delete them or move them out of the INBOX" I guess that means if I use a filter to move a message into another folder, the message will be deleted from the server? If so, is there any way to get the windows function in the linux version? Thanks Pete Holsberg wrote: > In the windows version, I can leave messages on server "until I delete > them", but the linux version says "until I delete them or move them out > of th...

New 3.5.2 version does not have a X to close the last or sole open window, when all older versions had it, I want (need) this X back to close the last window opened.
Name: J.Elderberry Product: Firefox Summary: New 3.5.2 version does not have a X to close the last or sole open window, when all older versions had it, I want (need) this X back to close the last window opened. Comments: When one wants to remove all open web page(s) and keep a empty open Firefox, with nothing open in case one needs it, we now can't do it, we have to keep the last window opened. This is very annoyind to me because in my work, I have the good habit to close every web sites when my consultation of those sites are finished. It's like closing a dictionaty w...

Cool new version in general on Windows, but major accessibility problems on mac os 10.4
Name: Adam Thompson Email: adsdotmessagesatgmaildotcom Product: Firefox Summary: Cool new version in general on Windows, but major accessibility problems on mac os 10.4 Comments: I am blind, and use both windows and Mac. On my Windows Xp Sp3 computer with Jaws for Windows 9 Firefox 3 is fine, however on my Mac (Intel, os 10.4.11) firefox is completely unusable. Only the window titles read with Voiceover (the screenreader which comes free with mac os 10.4 and above). It seems unable to recognise that there is anything in the windows most of the time, and if it recognises...

linux version is slower compared to windows version
Name: deepak Email: deepc01atgmaildotcom Product: Firefox Summary: linux version is slower compared to windows version Comments: i m using ubuntu 8.10 and have upgraded to firefox 3.5.2 but this version of version of firefox seems to be slower compared to the windows version. when i click any image(2mb in size) to enlarge it the linux version take time to display the image and after when it is displayed, when i right-click to save the image on my hard-disk, it takes the same amount of time to save. this is not the case with the windows version. image is instantly saved after...

Is there a TRichEdit98 version suitable for the latest delphi versions?
Hello all, I am using TRichEdit98 in an old component I am trying to port to DelphiXE so I was wondering if anyone knows if there exist a TRichEdit98 for Delphi 2010? Regards On 21-Sep-10 22:41, John Ioannides wrote: > Hello all, > > I am using TRichEdit98 in an old component I am trying to port to DelphiXE so I was wondering if anyone knows if there exist a TRichEdit98 for Delphi 2010? Have you looked at TJvRichEdit in the JVCL? Not sure how much work converting from TRichEdit98 to TJvRichEdit will be, but it's probably worth the trouble as TJvRichEdit is compa...

Version 3/Version 2 on Windows Vista
Name: G. Kisling Product: Firefox Summary: Version 3/Version 2 on Windows Vista Comments: I use Firefox 2 on Windows XP Professional at work and I like it very much, so when I got my Windows Vista Dell machine, I immediately installed Firefox 2 (have Firefox 3 installed as well). But I notice that unlike the one at work, it continuously crashes. For example, every time I try to load tennis.com the programme stops responding and I have to close it...thank goodness for restore mode. So I now use 2 browsers, Firefox for most stuff, and IE for the sites that crash Firefox. I a...

Will Delphi XE2 co-exist with other Delphi versions ?
Can I install it on a machine that's got other Delphi's on it ? Lut Mentz wrote: > Can I install it on a machine that's got other Delphi's on it ? Yes. As far as I know that has always been the case. -- -Mike (TeamB) Lut Mentz wrote: > Can I install it on a machine that's got other Delphi's on it ? Yes -- it has always been the case that the new version co-exists peacefully with all the older ones. -- Nick Hodges -- Product Development Manager Gateway Ticketing Systems http://www.gatewayticketing.com > {quote:title=Mike Williams ...

Can I install the 32-bit versions of ASP.NET 1.1 and the 64-bit version of ASP.NET 2.0 on a 64-bit version of Windows?
I have installed • The .NET Framework Version 2.0 Redistributable Package x64 (64 Bit) • The .NET Framework Version 1.1 Redistributable on my Windows Server 2003 x64 edition and then, I have run cscript %SYSTEMDRIVE%\inetpub\adminscripts\adsutil.vbs SET W3SVC/AppPools/Enable32bitAppOnWin64 1 and %SYSTEMROOT%\Microsoft.NET\Framework\v1.1.4322\aspnet_regiis.exe -i to enable .net framework 1.1,but the IIS will disabled the .net framework 2.0. Anyone who can tell me how to enable the both .net framework above at the SAME time instead of SWITCH. Th...

Install Delphi 2010 Ent in Windows XP or Windows 7
What operating system would you recommend installing and using Delphi 2010 Enterprise in? Windows XP or Windows 7 32 bit or 64 bit. And why? Thanks Greg Saunders wrote: > What operating system would you recommend installing and using Delphi > 2010 Enterprise in? > > Windows XP or Windows 7 Windows 7. > > 32 bit or 64 bit. 32 bit. > > And why? Windows 7 is a lot supperior and more stable than windows XP, also it recognizes more than 3 GB of RAM. Delphi 2010 supports Windows 7 Libraries, you can take advantage of this in yo...

Delphi Program Running Under Windows 8 vs. Windows 7
If a program, created with D2007, runs fine under Windows 7, it should run under Windows 8, correct? It's basically the same Intel architecture, right? The program created with D2007 does nothing fancy - I'm no professional programmer. Installation may be slightly different - i.e., the installation program may need some modifying I assume, to install under Windows 8. I don't have Windows 8 right now, I'm just trying to gather some information for a client. Thanks Your program won't run only on Windows RT (ARM version of windows). On all other versio...

Web resources about - windows version - embarcadero.delphi.general

Window - Wikipedia, the free encyclopedia
This article is about the part of a building. For the Microsoft operating system, see Microsoft Windows . For other uses, see Window (disambiguation) ...

Microsoft Windows Information, Solutions, Tools - Windows IT Pro
Microsoft Windows information and solutions for IT pros. Topics include cloud computing, Windows Server, Exchange, Outlook, PowerShell, virtualization, ...

The Windows Blog
The Windows Blog is Microsoft's Official Blog for the Windows Operating System.

Microsoft confirms the Windows 10 November Update WAS pulled and this is why
Over the weekend we spotted that the Windows 10 November Update (aka Threshold 2) had been removed from the Media Creation Tool (MCT), and had ...

Microsoft Black Friday deals that Windows 10 fans will love
Microsoft’s Black Friday offer includes discounts on several devices and also a special sale on digital products available from its content store. ...

CNET UK podcast 459: The right way to watch Star Wars, Bezos' rocket and your thoughts on Windows Phone ...
Google's Star Trek-style wearable, a historic rocket and whether we need "The Phantom Menace" are all up for debate on the latest episode of ...

Microsoft Windows 10 v1511 MCT is back, baby. Here's why it vanished...
Microsoft is sorry for yanking the Windows 10 November update a few days ago. But now the version 1511 download is back via the Media Creation ...

Sony confirms official PS4 Remote Play app for Windows and Mac
Well that was quick. It's only been a couple of days since someone came up with an unofficial app to stream PlayStation 4 gaming to PC, but earlier ...

Turkish Consulate in Moscow Was Stoned and Had Bottles Thown Through It’ Windows
Over five hundred people gathered at Turkish embassy in Moscow to protest and throw stones, bottles, paint cans and even eggs into the building ...

Media Creation Tool Succumbs to Windows 10 Update
In the November update, an alternate Windows 10 installation method is pulled while some users complain about disappearing software.

Resources last updated: 11/27/2015 2:30:35 PM