Re: [ros-dev] Distinguish between Windows and ReactOS

2018-11-06 Thread Nick Surfer
Thank you all for advice, they are useful for me.

___
Ros-dev mailing list
Ros-dev@reactos.org
http://www.reactos.org/mailman/listinfo/ros-dev

Re: [ros-dev] Distinguish between Windows and ReactOS

2018-11-05 Thread Oliver Schneider
Hi Nick,

On 2018-11-05 18:09, Nick Surfer wrote:
> I am writing a program which needs to know exact environment in which it
> is running. In case of Windows I simply use GetVersionEx and then
> analyze dwMajorVersion + dwMinorVersion which is enough for my case
> (then I know which WIN API calls I should use). But I stuck how to
> recognize that my program runs in ReactOS. I failed to find any docs
> about it. Any help is appreciated. 
For most scenarios this is even wrong for Windows itself. For example in
order to figure out if the ITaskbarList4 COM interface is available you
should NOT check the OS version and then act depending on whatever you
found out. Instead you should attempt to query for the interface and use
it if you succeed. It's trivial to create a shim class that will return
S_FALSE for each method called when the interface could not be queried.

Similarly if you are interested in a function that only exists on, say,
Windows 7, you'd use GetProcAddress() to find if the function you're
interested in exists. If it doesn't you'd use your fallback code path.

Of course if the function you are requesting behaves in a completely
different way than the original you'd be out of luck. But in case of
ReactOS _such_ observation should prompt you to file a ticket for the
defect (unless it's a known one). The point here is that for public and
documented functions there's pretty much a contract, just like for COM
interfaces.

Generally it's a suboptimal idea to use the OS version to conditionally
execute this or that code path. Instead try to check for capabilities
and go by whatever finding that gives you ...

Further reading:


Hope this helps,

Oliver

PS: now if you wanted to tell ReactOS apart from Windows one way would
be to look into the version information resource of one of the
well-known DLLs. kernel32.dll comes to mind. But as I pointed out above,
you likely do NOT want to do this NOR need this for all but a few edge
cases.

___
Ros-dev mailing list
Ros-dev@reactos.org
http://www.reactos.org/mailman/listinfo/ros-dev

Re: [ros-dev] Distinguish between Windows and ReactOS

2018-11-05 Thread David Quintana (gigaherz)
It is the policy of ReactOS that we should not provide a direct way to apps
to distinguish ros from Windows, as a means to avoid apps including hacks
that are ReactOS-specific, which would be really bad for the progress of
reactos in trying to become more and more compatible with Windows.

In that spirit, the same thing you do for Windows 2003 sp2, should work in
ros, and if it does not, then we have a compatibility problem in our hands,
that might need an issue report at our JIRA site ( https://jira.reactos.org/
)

On Mon, 5 Nov 2018 at 19:10, Nick Surfer  wrote:

> Hello all.
> Sorry if this mail is off topic of the mail-list, but am not sure which
> one is right for my question.
> I am writing a program which needs to know exact environment in which it
> is running. In case of Windows I simply use GetVersionEx and then analyze 
> dwMajorVersion
> + dwMinorVersion which is enough for my case (then I know which WIN API
> calls I should use). But I stuck how to recognize that my program runs in
> ReactOS. I failed to find any docs about it. Any help is appreciated.
> P.S. I am not well experienced in WIN API, so if someone gives me an
> example it will be great.
> ___
> Ros-dev mailing list
> Ros-dev@reactos.org
> http://www.reactos.org/mailman/listinfo/ros-dev
___
Ros-dev mailing list
Ros-dev@reactos.org
http://www.reactos.org/mailman/listinfo/ros-dev