Find out running on XP embedded - language-agnostic

Is there a way to find out if my program is running on XP embedded? I've tried .NET System.Environment.OSVersion, but the version information looks like that of a "normal" Windows XP, except for the minor version number, and relying on that seems to fragile to me.

A Microsoft eMVP (Bing Chen) on Egg Head Cafe suggests GetVersionEx and a particular version registry key...
1. Call API
BOOL GetVersionEx(LPOSVERSIONINFO lpVersionInfo);
OSVERSIONINFOEX structure (which is
the output of this call)
One of the members is wSuiteMask (a
WORD variable).
Check the VER_SUITE_EMBEDDEDNT
(0x00000040) flag in this variable.
2. Query value in Registry [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Product-Options]
Key Name: ProductSuite Type:
MULTI_SZ Value: EmbeddedNT
(In XP Pro, it seems that no
content in this key)
While Helen Elcock suggests looking for the FBA registry value:
I check for for the DWORD registery value
[HKEY_LOCAL_MACHINE\SYSTEM\FBA]
You only get first boot assistant on embedded.
GetVersionEx seems like the more stable approach, because someone might remove the FBA key in an effort to save another couple bytes, but I'm not sure if removing that key would cause the FBA to run again anyway. You'll probably be fine with either approach.

Related

How do I Uniquely identify an appx package

I'm working on a UWP app that will be installed on a device running Windows 10 IoT.
I need to be able to uniquely identify the appx package that corresponds to my app. I need something that is not going to change between builds and releases.
I am able to the following information from a web request to `http://insertIPAddressHere:8080/api/app/packagemanager/packages:
Ive removed the bits the parts that might be sensitive, but you can type Get-AppxPackage into powershell to get an idea of what the removed fields look like. The PackageFamilyName from powershell seems to correlate with the PackageRelativeId from the web request.
{
"InstalledPackages":[
...
{
"CanUninstall":true,
"Name":"removed",
"PackageFamilyName":"removed",
"PackageFullName":"removed",
"PackageOrigin":5,
"PackageRelativeId":"removed",
"Publisher":"removed",
"Version":{
"Build":68,
"Major":0,
"Minor":0,
"Revision":0
},
"RegisteredUsers":[
{
"UserDisplayName":"removed",
"UserSID":"removed"
}
]
}
]
}
I thought about hardcoding in the PackageRelativeId, but I'm not sure if that's an appropriate way to identify my app. It has what what looks like some randomly generated characters, and I haven't yet found anything that reassures me that value will remain the same between builds and revisions. I can't find it anywhere in my solution. It's only mentioned in some of the compiled files.
PackageFullName is your unique identifier in this case -- it will encode the package name, version, and publisher.
If you don't want the package version as part of your identifier, use PackageFamilyName.
You can see all this via powershell:
get-appxpackage | where name -eq "My.PackageName"

Stream .LRF files via webbserver

i've noticed that on LoLReplays webpage you can now stream live games via their program LoLRecorder. I found this code on their page
href="lrf://spectator spectator.eu.lol.riotgames.com 2nHvYdkaSjjqC7f+mtHQeIhFcUSQLFu5 488978485 EUN1 3.01.0.1"
And i've tried a little to stream from my own (already recorded) game. But all i get is unable to find match. My question is: Does anyone here know how this works?
Thanks!
TL;DR; You can't stream anything, but you can open LoLReplay in spectator mode for a specific match.
Try reinstalling LoLReplay, seemed to fix the issues that I was having.
The title of your post is somewhat misleading as no streaming actually happens - all that the link does is open LoLReplay on your local machine and pass in the details of the match you want to spectate.
This will only work for matches that are happening now, as it connects in a similar way as the LoL client does when you spectate a match.
Calling LoLReplay from the browser
The links seem to be formatted as follows:
lrf://spectator [Observer IP Address][:Observer Port] [Observer Encryption Key] [Game Id] [Platform Id] [Client Version?]
lrf://spectator tells LoLReplay to open up in spectator mode.
Observer IP Address is required and can either be a hostname or an IP address. The hostname is usually in the format spectator.[eu/na/br/etc.].lol.riotgames.com.
Observer Port is optional, I believe it defaults to 8088 which appears to be the default spectator mode port.
Observer Encryption Key... is a required per-match encryption key.
Game Id is a required, per-match integer id.
Platform Id is a more specific version of the region, I guess relating to how Riot have grouped their servers. For example EUW1.
Client Version, the last field appears to be a version number - I can only assume this is either the version of the client that LoLReplay is using OR the version of the client the players in the match are using.
How to find IP address, encryption key etc.
Edit: you can now grab all the info you need using the official Riot API, you just need the SummonerId of the user you're querying for. See current-game API docs for usage.

Is MutationRecord.oldValue something I should be using?

I'm using the latest Google Chrome stable (19.0.1084.56 m) on Windows 7 and experimenting with Mutation observers for the first time. (The project is a user script for a third party website, the server of which I have no access to.)
So it happens that MutationRecord has a field oldValue:
record . oldValue
The return value depends on type. For "attributes", it is the value of the changed attribute before the change. For "characterData", it is the data of the changed node before the change. For "childList", it is null.
So I'm monitoring for changes to the characterData but when I get the MutationRecord the oldValue field is always null.
Should it be working, is there a possibility I've got something wrong, or is this feature just too bleeding edge to expect to work yet?
Is there somewhere I can find Google's documentation, bug report, feature request, etc that might declare whether this is implemented or when it might be?
Configure your observer with:
observer.observe(container, {
attributeOldValue : true
});
Full API documentation:
https://developer.mozilla.org/pt-BR/docs/Web/API/MutationObserver

WebSockets in Python3.1 handshake problem

i am using python3.1 ,so i found a html5 websocket snippet here:
http://www.nublue.co.uk/blog/threaded-python-websocket-server-and-javascript-client/
I test with chrome.
After send handshake packet,web client has no response as expect(websocket.onopen is not fired).I do receive client's request.
.i tried many times.It just not work.
Here is a .NET code:
http://nugget.codeplex.com/
I test it,it works fine.so my chrome is ok.
I wanna know is there any python3.x demo code can give me a help.
And my machine:
WIN7 pro X86
thanks.
The noVNC project (a HTML5 VNC client) contains a python 2.X (but should be easy to convert to 3.X) utility named wsproxy which is a WebSockets to generic TCP proxy. It transparently supports v75 and v76 (which has new handshake) of the WebSockets protocol.
If you're still working on it, that might be a helpful reference at least.
Disclaimer: I made noVNC and wsproxy.
oh.i got it .
that article is obsolete.
and see:
http://en.wikipedia.org/wiki/Web_Sockets
sum of the concatenated string.[1]
sum of the concatenated string.[1]> The Sec-WebSocket-Key1 and
Sec-WebSocket-Key2 fields and the 8
bytes after the fields are random
tokens which the server uses to
construct a 16-byte token at the end
of its handshake to prove that it has
read the client's handshake. The
handshake is constructed by
concatenating the numbers from the
first key, and dividing by the number
of spaces. This is then repeated for
the second key. The two resulting
numbers are concatenated with each
other, and with the last 8 bytes after
the fields. The final result is an MD5
sum of the concatenated string.[1]sum of the concatenated string.[1]
sum of the concatenated string.[1]

Error deleting a record using Linq2SQL

I've received an error report from a client recently and am having no luck resolving it. I'm hoping someone can give me some insight to what may be wrong.
The error seems simple enough:
Csla.DataPortalException: DataPortal.Delete failed (System.InvalidOperationException: Sequence contains more than one element at System.Linq.Enumerable.SingleOrDefault[TSource](IEnumerable`1 source)
Here is my DataPortal_Delete method, which takes the FileId (PK) as a parameter.
private void DataPortal_Delete(SingleCriteria<File, Guid> criteria)
{
using (var ctx = ContextManager<Ronin.Data.RoninDataContext>
.GetManager(Database.ApplicationConnection, false))
{
var data = ctx.DataContext.Files
.Single(row => row.FileId == criteria.Value);
ctx.DataContext.FileSources.DeleteAllOnSubmit(data.FileSources);
ctx.DataContext.Files.DeleteOnSubmit(data);
ctx.DataContext.SubmitChanges();
}
}
First thing I check was to see if there was another record with the same FileId (although being the primary key, this should be impossible). All FileIds were in fact unique. I launched the application connecting to the client database and tried to delete the record and it worked without any issues. The IT guy at the client site used the "Problem Step Recorder" to send me step by step screenshots of the actions taken by the user. Nothing out of the ordinary, and when he used a different machine, he was able to delete the record without any errors. Apparently this only happens when the application is run in Windows 7.
That said, any ideas as to what could be causing this?
Assuming the call to Single is the source of the problem, instead of:
ctx.DataContext.Files.Single(...)
change the code to allow the return of multiple rows from that query and then log what it's returning when it returns more than one row. This should point you toward your "duplicate" data problem.
Another thing to look at is the SQL that is being generated behind the scenes. Not sure that will help, but it can't hurt. I don't know your data model, so I can't understand your code as well as I would like to.
If it only happens in Windows 7 then this might be cause by the OS. Have you tried it on Vista? Vista's environment is simmilar on Windows 7. You can also use Windows Virtual PC + XP Mode. This is a virtualization application specially designed for Windows 7 to let users run applications like they use to in Windows XP. Note: XP Mode requires virtualization capable processor.
I had the same exception when deleting one entity. The problem turned out to be a foreign key relation defined in the dbml-File. So this was the reason for the exception in my case.
After I removed that it worked to delete the record (and I didn't want to cascade delete the records from the other table, I just need to find out how to configurate linq-to-sql to just set the foreign key column to null)