Annoyance in the Windows SDK headers

Today I ran into the following error:

Error	1	error C2733: second C linkage of overloaded function '_interlockedbittestandset' not allowed	$VCDIR\include\intrin.h	944
Error	2	error C2733: second C linkage of overloaded function '_interlockedbittestandreset' not allowed	$VCDIR\include\intrin.h	945

Eeek, what’s going on there? Well, my first instinct was to redefine the name to something else to see what breaks. Turns out that doesn’t help a lot depending on where you do that. The problem appears to be that the two intrinsic functions _interlockedbittestandset and _interlockedbittestandreset are declared both in WinNT.h and in intrin.h. Actually it’s also “defined” (in quotes because it’s using #pragma intrinsic) as an intrinsic in WinNT.h, and we won’t get around this easily, because if we change the name of those intrinsics before including WinNT.h, the compiler is going to complain that it has no clue what intrinsic it is we want to use:

Warning	1	warning C4163: '_local_interlockedbittestandset' : not available as an intrinsic function	$SDKDIR\Include\winnt.h	3124
Warning	2	warning C4163: '_local_interlockedbittestandreset' : not available as an intrinsic function	$SDKDIR\Include\winnt.h	3125

Now that is annoying. However, I didn’t want to go for the invasive method of editing one of the SDK headers. Instead I decided to use the powers of the preprocessor to my advantage. The first issue here was to make sure WinNT.h gets included first. For most Windows code this is a given with Windows.h providing this prerequisite.

Next I had to include intrin.h (which contains a convenient #pragma once) in the main source file which created the mess in the first place. However, in order to mask out the second declaration of the function I had to rename it. That’s where the preprocessor comes in:

#if _MSC_VER >= 1400
//  Following 8 lines: workaround for a bug in some older SDKs
#   pragma push_macro("_interlockedbittestandset")
#   pragma push_macro("_interlockedbittestandreset")
#   pragma push_macro("_interlockedbittestandset64")
#   pragma push_macro("_interlockedbittestandreset64")
#   define _interlockedbittestandset _local_interlockedbittestandset
#   define _interlockedbittestandreset _local_interlockedbittestandreset
#   define _interlockedbittestandset64 _local_interlockedbittestandset64
#   define _interlockedbittestandreset64 _local_interlockedbittestandreset64
#   include <intrin.h> // to force the header not to be included elsewhere
#   pragma pop_macro("_interlockedbittestandreset64")
#   pragma pop_macro("_interlockedbittestandset64")
#   pragma pop_macro("_interlockedbittestandreset")
#   pragma pop_macro("_interlockedbittestandset")
#endif

Since intrin.h got introduced with VS 2005, we check for this precondition. Then we save (push_macro) the values of the _interlockedbittestandset and _interlockedbittestandreset defines, if any. Then we rename them and include intrin.h, thus creating a definition for functions _local_interlockedbittestandset and _local_interlockedbittestandreset and then we restore (pop_macro) the old values of the macros using those function names, just in case.

This could of course be put into a local header, so as to not repeat this every time we need to use WinNT.h and intrin.h together in a source file.

Attention: make sure that none of your headers ends up including intrin.h on its own before the above fix. This will break the fix as Roan found out and remarked in a comment. Sorry for not being more explicit about this requirement before.

Problem solved :mrgreen:

Update: Mozilla came up with a subset of my solution here. It won’t work if you make use of those functions, though. Because in this case later references will get renamed according to the macro expansion rules.

// Oliver

PS: the problem also exists for _interlockedbittestandset64 and _interlockedbittestandreset64 (now included in the fix above)
PPS: it should also be possible to throw this last block above the inclusion of WinNT.h – haven’t tested that, though.

Posted in C/C++, EN, Programming | Tagged , , , , , , , | 3 Comments

The best satire since Starship Troopers, if you ask me

Officially Iron Sky (plot description contains spoilers!) is a comedic film. This is probably due to the fact that it is not based on a book such as Starship Troopers. It certainly has loads of comic moments, as all satires should. However, it comes loaded with messages and social criticism (and not just the one directed at Nazis).

I won’t include any spoilers as the movie is still in the cinemas.

A word of warning: if you don’t know German and English, make sure that the movie comes subtitled in a language you can read and understand well. The entire movie is – I would say about 50:50, perhaps 40:60 – German:English. So if you’re a foreigner in Iceland and happen not to understand both, wait for a version with English subtitles :mrgreen:

Either way, a few hints – in particular about the film quotes I recognized off hand (unfortunately most people in the cinema took a while to recognize these – no one seemed to recognize the last one):

  • if you don’t know “The Great Dictator” with Charlie Chaplin, make sure you watch it or get acquainted with its contents. And I mean the long version (you’ll get what I mean after watching Iron Sky).
  • if you don’t know “Der Untergang” (“Downfall”), make sure you are acquainted with it. Alternatively watch one of the “Hitler (is) not amused” meme videos on Youtube.
  • if you haven’t watched “Dr. Strangelove” with Peter Sellers, make sure you do. Actually this is a movie worthy watching in its own right. Both because of a brilliant Peter Sellers and because it is a satire, too. In Iron Sky watch out for the scene where a man sits in a chair and tries to constrain his hand 😉 … that’s the film quote I mean.

Cast (in no particular order)

Peta Sergeant brilliantly plays Vivian Wagner, advisor to the campaign of a Sarah Palin-like president caricatured in the movie. It is one of the most important roles in the film aside from the Nazi roles. Even the US president is somewhat secondary to this role. My favorite quote: (grinning) “He fell for the ‘one last blow job’ trick. Nazis are so stupid.”.

Udo Kier, one of the old timers those in the know will recognize from films such as Mark of the Devil or a lot of horror movies, plays Führer Kortzfleisch, which is particularly funny because of the sound of that name in German. Aside from that no one really bothers to greet him with the Nazi salute referring to him, but still referring to Adler. My favorite quote: “Die Zeit ist die Sünde” (the time is a sin). All Germans reading this, watch out for Kiers Cologne accent. It shines through a few times, which makes it even funnier.

Julia Dietze plays Renate Richter, a lovely and somewhat naive young teacher of “Earth Sciences”, which in this context (with Nazis on the Moon) has of course a slightly different meaning, and English. My favorite quote: “… the way you are meant to be”.

Christopher Kirby plays the astronaut James Washington. He was sent to the Moon as a campaign feat for the president because he’s black and this supposedly would look good. Campaign poster on Times Square: “Black to the Moon? – Yes she can!” 😆

Götz Otto plays one of the main antagonists Nachrichtenübermittlungsoffizier (literally: message delivery officer) Adler, an ambitious Nazi who is set to become the next Führer after Kortzfleisch and wants to speed up the process. My favorite punchline – not to say knockout line (pun intended): “As they say in English: you’re a knockout” …

Tilo Prückner, one of my favorite German character actors and known from many TV series and movies, plays the mad scientist and father of Renate, Dr. Richter. My favorite quote: “zis is not a Computer”, holding up a smart phone and stepping over to the wall with blinking lights and stuff, exclaiming: “zis is a computer!” 😆

Stephanie Paul plays – quite nicely – a Sarah Palin-like president whose campaign is grinding to a halt and who is in desperate need of some miracle to get reelected. Despite the character caricaturing Palin, there is some historic knowledge such as the Nazis being the only enemy the US beat in a fair fight (which, I suppose, especially Russians would contest). However, this ignorance is part of the story and actually plays a role in the meetings of the UN security council that we get to witness as viewers. This character would have had a bit more potential all in all.

The lovely details

Except for the German writing on the black board in one of the introductory scenes, everything is authentic. The reason they used Fraktur to write this text, is because even most Germans these days cannot read the (non-Latin) writing that has been used in these days, such as Sütterlin. So the choice is purely for dramatization, which I can readily accept. Side-note: Nazis prove how stupid they are by using Fraktur to write their slogans, even though Hitler himself shunned and actually forbade a very similar style called Schwabacher as “Judenschrift” (i.e. Jewish, implying bad).

The German spelling as far as I could see it in many of the cut scenes looked perfect (given the German cast, this should be a given, but I remember otherwise from too many movies).

Even the style of the spoken language was pretty much authentic. I didn’t notice any glitches that didn’t owe to the plot.

All in all I will go and see this movie again. It’s great fun and I warmly recommend it to everyone who can read (the subtitles) and won’t be offended by a satire that doesn’t stop at mocking the Nazis 😉

There is one glitch in the film when Adler receives an electric surge through his leather gloves …

// Oliver

PS: one last thing. This movie, despite minor imperfections shows again that European films can certainly keep up with Hollywood movies without the same huge budget. It doesn’t take a Michael Bay and more than 250 million US dollars to make a great film. Thanks Timo Vuorensola and everyone who participated.

Posted in EN, Germans have no notion of sarcasm | Tagged , | 1 Comment

What a beautiful day indeed …

Today was even more awesome. Met with someone at 11:30, had a decent chat for about three hours, had a nice walk, met more nice people, went to shop supplies, drove to another place had a nice BBQ from the supplies, geeked out with a bunch of awesome people (and at the same time geeks, yeeeessss that is possible :mrgreen:), had an awesome walk back home after 22:00 with the sky still blue and red from the sunset, now sipping cognac with a few pieces of chocolate on the side and my keyboard in front of me.

I feel inspired.

// Oliver

Posted in EN, Thoughts | Tagged | 2 Comments

What a beautiful day …

… to watch Iron Sky. What better date to watch a movie that mocks Nazis than at the “Führer’s” birthday? :mrgreen:

Anyone with me? Bío Paradís, Reykjavík, Iceland, tonight at 20:00.

Achtung, Achtung! Ze Germans are coming to see ze movie! 😆

// Oliver

PS: Some colleagues keep telling me it’s “Ironsky” (pronounce: eeh-ronn-s-kee), a Russian agent thriller, but I don’t believe them.
PPS: I’m afraid some US-Americans are not going to like some of the aspects of that film. But it’s not actually meant as a comedy, but as a satire …

Posted in EN, Germans have no notion of sarcasm | Leave a comment

Ich hätte nicht gedacht, daß es jemals soweit käme …

… aber ich denke, daß ich einer Partei beitreten werde.

Diese Partei verkörpert eine Lösung – unter Ausnutzung der aktuellen Rechtslage – für das Problem welches ich oft und lautstark anprangere. Die Tatsache, daß in Deutschland keine NEIN-Stimmen auf dem Wahlzettel möglich sind, bzw. daß zumindest Ungültigwähler auf das Wahlergebnis Einfluß nehmen können. Ungültigwähler sind nämlich in vielen Fällen Bürger, die aus Prinzip wählen gehen, aber keine Alternative sehen als ungültig zu wählen. Es handelt sich da nicht ausschließlich um Leute die nur zu blöd sind einen Wahlzettel gültig auszufüllen …

Meine Bedenken bzgl. der Partei NEIN!-Idee sind einzig, daß sich irgendwann – ähnlich wie unlängst bei den Piraten geschehen – eine größere Anzahl Mitglieder dafür Aussprechen könnte das Programm so abzuändern, daß die Idee verloren geht und die Partei damit unwählbar wird. Man wird sehen. Austreten kann man in diesem Fall immernoch.

Erstmal gilt es herauszufinden, ob und wie ich als Bundesbürger der im Ausland wohnhaft 1 ist bei denen Mitglied werden kann.

// Oliver

  1. … deutsches Recht erlaubt es nicht einen Zweitwohnsitz in Dtl. anzumelden, wenn nicht auch der Erstwohnsitz im Inland ist. Gleichzeitig behaupten Politiker sie wollten Schranken für die Arbeit im europäischen Ausland aus dem Wege räumen. Die Regelung betrifft auch EU-Staaten. Island ist glücklicherweise noch nicht in der EU.[]
Posted in DE, Gedanken, NEIN!-Idee | Tagged , | 3 Comments

A good cause

International Letter & Petition to Asma al-Assad, first lady of Syria. It is a very moving and yet very disturbing clip. Sign the petition here, I did.

And spread the word.

Although I’m certain that some bigger conflict (Iran) is lurking just behind this one, once Assad has been toppled, I think the bloodshed has to stop.

The full text (that I signed):

Stop the bloodshed in Syria

Open letter to Asma Al-Assad

Dear Asma…

Some women care for style
and some women care for their people.

Some women struggle for their image
and some women struggle for their survival.

Some women have forgotten what they preached about peace
and some women can only pray for their dead.

Some women pretend that they have no choice
and some women just act.

What happened to you, Asma?

Hundreds of Syrian children have already been killed or injured.

One day, our children will ask us what we have done
to stop this bloodshed.

What will your answer be, Asma?

That you, Asma had no choice?
What about this boy, where was his choice?

Every single child had a name and a family.
Their lives will never be the same again.

Asma, when you kiss your own children goodnight,
another mother will find the pace next to her empty.

These children could all be your children.
They are your children.

Stand up for peace, Asma.
Speak out now. For the sake of your people.
Stop your husband and his supporters.

Stop being a bystander.

No one cares about your image.
We care about your action.

Right now.

Oliver Schneider

Posted in EN, Human Rights, Peace | Tagged , | Leave a comment

Nett, eine sichere Pastebin-Alternative

Projektseite und Testinstallation (des Autors?)

Super Geschichte. Ich hoffe, daß es noch auf GitHub oder BitBucket erscheint, so daß man die volle Versionsgeschichte bekommt.

// Oliver

Posted in DE, IT Security, Software | 2 Comments

Raspberry Pi shipping …?

Seems the first batches went to Farnell and RS. I registered my interest at RS already, let’s see. Seems like the demand is way above supply, so it’s pure chance. Besides, it appears that they sell only one per person from the first batches …

We shall see.

// Oliver

Posted in EN, Linux, Programming, Software, Unix and unixoid | Tagged | Leave a comment

Wow again, Norway …

It’s incredible how calm people remain in the face of this person who did those gruesome things. The Norwegians have my sincerest respect and compassion, in particular those that have been injured (body and mind) for life.

And frankly I’m moved to tears to see young people like his (surviving) victims stand up for the rights of a man who to most people has forfeit the right to be treated humanly. And yet, this may be the most hurtful thing for Breivik and people who think like him: the fact that a society doesn’t give in to such gruesome acts and changes its ways just as so many other “Western” countries did already.

Breivik may seem like a cynic, but it’s clear from his reaction (crying in court) that he isn’t the tough man he likes to present himself as.

Respect, Norway. Respect …

Posted in EN, Thoughts | Tagged , | Leave a comment

Thank you, whoever you are. Thank you sooo much!

Finally someone says it.

Finally!

gitvsmercurial.com

Quote:

Who the FUCK cares?
Use what YOU like, not what someone on the internet tells you to.

I wholeheartedly agree. Except when read vertically :mrgreen:

Posted in EN, Programming, Software, VCS | 2 Comments

Finland’s Revolutionary Education System

Finland’s Revolutionary Education System

Unfortunately they forgot to mention who inspired the Finnish system. Which is what got the German authorities thinking when they asked the Finns :mrgreen:

Posted in EN, Thoughts | Leave a comment

Antwort des CCC

Hier die Antwort einiger Hacker des CCC auf den gestern veröffentlichten offenen Brief der “Tatort”-Autoren.

Kommentar: grundsätzlich schließe ich mich der Argumentation dieser CCC-Hacker an. Jedoch gilt ähnliches für andere Berufe auch – wobei hier ggf. keine besondere geistige Leistung nötig ist/war. Beispielsweise wird ein Schmied auch nur einmal für sein Werk bezahlt und sollte den Preis entsprechend gestalten und sich nicht danach beschweren wenn er die finanzielle Gegenleistung als zu gering erachtet. Hier stellt sich eben die Frage ob die mehrfache Entlohnung bei geistiger Leistung im Gegensatz zu einfacher Entlohnung bei physischer Leistung angemessen und gerechtfertigt ist. Und wie die Autoren der Antwort ausführen, werde ich als Entwickler für meine geistige Leistung bspw. auch nur so entlohnt wie ein angestellter Schmied entlohnt würde: einmalig.

Im Zusammenhang mit den “Tatort”-Autoren stieß mir aber auf, daß diese von Zwangsgebühren bezahlt werden und damit nicht zuletzt ihren eigenen Finanziers (den Gebührenzahlern) ans Bein pinkeln. Denn dank der Tatsache, daß heutzutage auch PCs GEZ-pflichtig sind und es bald eine haushaltsbezogene Abgabe geben wird, ist im Prinzip jeder der in D wohnhaft ist GEZwungen die Gebühr zu bezahlen und ansonsten mit Außendienstmitarbeitern in Blockwartmanier konfrontiert zu werden.

// Oliver

Posted in CCC, DE, Gedanken | Leave a comment

PatVerfü gegen staatliche Willkühr

Im Zusammenhang mit den aktuellen Meldungen über das elfjährige Transmädchen Alex aus Berlin (unter anderem hier) stolperte ich über die PatVerfü.

Dabei handelt es sich um eine spezielle Patientenverfügung welche unter anderem ausdrücklich untersagt eine psychiatrische Diagnose zu stellen. Damit ist jeglicher psychiatrischer Zwangsbehandlung – unter welchem Vorwand auch immer – die Grundlage entzogen. Ich kann nur empfehlen sich einmal die Seite zu Gemüte zu führen um die Risiken kennenzulernen und dann in die eine oder andere Richtung eine Entscheidung zu treffen.

Dem Transmädchen hätte es aber ohnehin nicht geholfen, da sie noch nicht im geschäftsfähigen Alter ist und daher keine Patientenverfügung abfassen und wirksam werden lassen kann.

// Oliver

Posted in DE, Gedanken | 1 Comment

“Meet The Hackers Who Sell Spies The Tools To Crack Your PC (And Get Paid Six-Figure Fees)”

Interesting article about Vupen to which a colleague pointed me (thanks, Anna 😉 ).

I have problems with their business model on so many levels, but just two points:

  • Their business is completely legal, although it may be immoral
  • I doubt selling to “democratic” or “NATO” governments will make any difference here. This is more likely to keep up a lucrative business rather than for ethical reasons. If they sold it to “rogue states” (by definitions of certain Western “democracies”) they’d risk their business model. Besides, if you look at the legalese that was written in the past decade or so that cuts our civil liberties and creates more of an Orwellian society in all Western “democracies” what exactly is the difference between a “democratic” government spying on me and a “nondemocratic” one doing the same? Aren’t they closing the gap with the “democracies” moving towards authoritarian societies?

// Oliver

Posted in EN, IT Security, Thoughts | Tagged , , , | Leave a comment

“What America Lost When Dennis Kucinich Lost”

Interesting read: “What America Lost When Dennis Kucinich Lost

Posted in EN | Leave a comment

Aaaaargh

The Icelandic customs did it again. So I was expecting a parcel from the family. It was a little late already anyway. Guess what I got today? … a standard letter stating limits (10000 ISK == 60 EUR at current rate) for gifts if this happens to be a gift – which the bloody customs declaration states clearly (i.e. that it is a gift).

Oh and to add insult to injury they attached the (original) customs declaration (in the original two copies, phrased in English and even saying Note for Icelandic customs officer) which lists the values of the items in great detail and now ask me in the letter to send them the information contained in that very declaration.

I read somewhere that Iceland has a 100% literacy rate. Those sources appear to be wrong.

// (annoyed) Oliver

Happy end: on Thursday last week the parcel arrived without further ado.

Posted in EN, Island/Iceland/Ísland | Leave a comment

Polittheater

Soll der Wulff sich doch seinen Zapfen streichen lassen. Ist mir doch egal.

Posted in DE, Ich, der Zyniker | 1 Comment

Classic

Pöpcørn 😆

Posted in /dev/null, EN | Leave a comment

Censorship by mistake

Police Censor Google, Facebook and 8,000 Other Sites by Accident in Denmark.

Posted in EN | Leave a comment

ISOStick

looks interesting

But I guess I’ll wait for prices to drop. It somewhat looks like ideas where in part coming from this project. Which is not to say that was the case, but it’s a possibility as the other one is older.

Posted in EN, Thoughts | Leave a comment