Implementing Windows’ Restart Manager in Java

Disclaimer: I don’t know what I’m talking about, I’ve done little Win API (Win32) development and I only have a few years of Java development of which maybe 2 or 3 are developing desktop applications with JavaFX (Dashman being my first fully fledged out JavaFX app).

Disclaimer 2: I have only tested this on my own computer, running Microsoft Windows 10. I hope to soon test it in many others and over time we’ll see whether my solution was correct or not. I’ll update this blog post accordingly (or link to a newer version if necessary).

I started taking the quality of Dashman very seriously and one of the problems I found was that the running instances wouldn’t exit properly during uninstall or upgrades. And as I expected, this turned out into a head-bashing-into-brick-wall task. My solution was for a JavaFX app, but this should work for a Swing or any other kind of apps.

It all started with learning about Windows Restart Manager, something I didn’t know it even existed until a week ago. This is what allows Windows to close applications on uninstall, on reboots, etc. In the Guidelines for Applications, the crucial bit is this:

The Restart Manager queries GUI applications for shutdown by sending a WM_QUERYENDSESSION notification that has the lParam parameter set to ENDSESSION_CLOSEAPP (0x1). Applications should not shut down when they receive a WM_QUERYENDSESSION message because another application may not be ready to shut down. GUI applications should listen for the WM_QUERYENDSESSION message and return a value of TRUE if the application is prepared to shut down and restart. If no application returns a value of FALSE, the Restart Manager sends a WM_ENDSESSION message with the lParam parameter set to ENDSESSION_CLOSEAPP (0x1) and the wparam parameter set to TRUE. Applications should shut down only when they receive the WM_ENDSESSION message. The Restart Manager also sends a WM_CLOSE message for GUI applications that do not shut down on receiving WM_ENDSESSION. If any GUI application responds to a WM_QUERYENDSESSION message by returning a value of FALSE, the shutdown is canceled. However, if the shutdown is forced, the application is terminated regardless.

Simplifying it: when Windows needs your app to close, it will send a message asking if you are ready to close. Your application might respond negatively and then no application will be closed. This could happen for example if there’s some unsaved work and the app needs the consent from the user to either save or discard. This is what happens when you try to shut down your computer and Microsoft Word stops it asking whether you want to save the file or not.

After that your application can receive a message asking it to please close or telling it to close now. I’m not sure what the nuances are between these two. For Dashman I decided to just save the config and close in either of these instances.

Receiving these messages requires interfacing with Windows DLLs, for which I’m using JNA. I don’t know how JNA works, I read the code, sort-of understood it, copied and pasted it. What I think is going on is that you open the user32.dll like this:

User32 user32 = Native.loadLibrary("user32", User32.class, Collections.unmodifiableMap(options))

User32 is an interface that contains all the methods with the proper signatures to be able to call them from Java. options just makes sure we are using the Unicode version of the Win32 API calls. You can see that and all the other missing pieces on the full example at the end of the blog post.

I need a Win32 API callback that will receive the messages and actually implement the guidelines previously quoted:

StdCallLibrary.StdCallCallback proc = new StdCallLibrary.StdCallCallback() {
    public WinDef.LRESULT callback(WinDef.HWND hwnd, int uMsg, WinDef.WPARAM wParam, WinDef.LPARAM lParam) {
        if (uMsg == WM_QUERYENDSESSION && lParam.intValue() == ENDSESSION_CLOSEAPP) {
            return new WinDef.LRESULT(WIN_TRUE);
        } else if ((uMsg == WM_ENDSESSION && lParam.intValue() == ENDSESSION_CLOSEAPP && wParam.intValue() == WIN_TRUE) || uMsg == WM_CLOSE) {
            Application.exit();
            return new WinDef.LRESULT(WIN_FALSE); 
        }
        return user32.DefWindowProc(hwnd, uMsg, wParam, lParam);

    }
};

Oh! Lot’s of constants! What are they? I define them in the full example at the bottom of this post. They should be mostly self-evident what they stand for, their actual values are not that important.

Now things get tricky. Apparently Microsoft Windows send these messages to windows, not processes. Dashman can run in the tray bar, with no active window. And even if it had an active window, getting the HWND pointer for that window in JavaFX doesn’t seem trivial (I couldn’t get it to work). So, I create a size 0 invisible window to receive the message:

WinDef.HWND window = user32.CreateWindowEx(0, "STATIC", "Dashman Win32 Restart Manager Window.", WS_MINIMIZE, 0, 0, 0, 0, null, null, null, null);

Then I need to connect that window to the callback:

try {
    user32.SetWindowLongPtr(window, GWL_WNDPROC, proc);
} catch (UnsatisfiedLinkError e) {
    user32.SetWindowLong(window, GWL_WNDPROC, proc);
}

The callback is not magic though, and requires an event loop that will constantly check if there’s a message and trigger the processing when that happens:

WinUser.MSG msg = new WinUser.MSG();
while (user32.GetMessage(msg, null, 0, 0) > 0) {
   user32.TranslateMessage(msg);
   user32.DispatchMessage(msg);
}

Of course, that means you want this to run as its own daemon thread. The reason to make it a daemon thread is so that it won’t hang around preventing the JVM from exiting. 

One of my most useful sources of understanding and inspiration was the source code for Briar. I want to give credit where credit is due. I do think I spotted an issue with their source code in which they are not following the guidelines though. Also, they have a much more complex situation to handle.

And now, the full example with all my comments including links to more information explaining where all the values for constants and logic is coming from:

import com.sun.jna.Native;
import com.sun.jna.Pointer;
import com.sun.jna.platform.win32.WinDef;
import com.sun.jna.platform.win32.WinUser;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIFunctionMapper;
import com.sun.jna.win32.W32APITypeMapper;

import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

import static com.sun.jna.Library.OPTION_FUNCTION_MAPPER;
import static com.sun.jna.Library.OPTION_TYPE_MAPPER;

// Inspiration can be found at https://code.briarproject.org/akwizgran/briar
public class RestartManager {
    // https://autohotkey.com/docs/misc/SendMessageList.htm
    private static final int WM_CLOSE = 0x10; // https://msdn.microsoft.com/en-us/library/windows/desktop/ms632617
    private static final int WM_QUERYENDSESSION = 0x11; // https://msdn.microsoft.com/en-us/library/windows/desktop/aa376890
    private static final int WM_ENDSESSION = 0x16; // https://msdn.microsoft.com/en-us/library/windows/desktop/aa376889

    // https://msdn.microsoft.com/en-us/library/windows/desktop/aa376890
    // https://msdn.microsoft.com/en-us/library/windows/desktop/aa376889
    private static final int ENDSESSION_CLOSEAPP = 0x00000001;
    private static final int ENDSESSION_CRITICAL = 0x40000000;
    private static final int ENDSESSION_LOGOFF = 0x80000000;

    // https://stackoverflow.com/questions/50409858/how-do-i-return-a-boolean-as-a-windef-lresult
    private static final int WIN_FALSE = 0;
    private static final int WIN_TRUE = 1;

    // https://msdn.microsoft.com/en-us/library/windows/desktop/ms633591(v=vs.85).aspx
    private static final int GWL_WNDPROC = -4;

    // https://msdn.microsoft.com/en-us/library/windows/desktop/ms632600(v=vs.85).aspx
    private static final int WS_MINIMIZE = 0x20000000;

    public static void enable() {
        Runnable evenLoopProc = () -> {
            // Load user32.dll usi the Unicode versions of Win32 API calls
            Map options = new HashMap();
            options.put(OPTION_TYPE_MAPPER, W32APITypeMapper.UNICODE);
            options.put(OPTION_FUNCTION_MAPPER, W32APIFunctionMapper.UNICODE);
            User32 user32 = Native.loadLibrary("user32", User32.class, Collections.unmodifiableMap(options));

            // Function that handles the messages according to the Restart Manager Guidelines for Applications.
            // https://msdn.microsoft.com/en-us/library/windows/desktop/aa373651
            StdCallLibrary.StdCallCallback proc = new StdCallLibrary.StdCallCallback() {
                WinDef.LRESULT callback(WinDef.HWND hwnd, int uMsg, WinDef.WPARAM wParam, WinDef.LPARAM lParam) {
                    if (uMsg == WM_QUERYENDSESSION && lParam.intValue() == ENDSESSION_CLOSEAPP) {
                        return new WinDef.LRESULT(WIN_TRUE); // Yes, we can exit whenever you want.
                    } else if ((uMsg == WM_ENDSESSION && lParam.intValue() == ENDSESSION_CLOSEAPP
                            && wParam.intValue() == WIN_TRUE) || uMsg == WM_CLOSE) {
                        Application.exit();
                        return new WinDef.LRESULT(WIN_FALSE); // Done... don't call user32.DefWindowProc.
                    }
                    return user32.DefWindowProc(hwnd, uMsg, wParam, lParam); // Pass the message to the default window procedure

                }
            };

            // Create a native window that will receive the messages.
            WinDef.HWND window = user32.CreateWindowEx(0, "STATIC",
                    "Dashman Win32 Restart Manager Window.", WS_MINIMIZE, 0, 0, 0,
                    0, null, null, null, null);

            // Register the callback
            try {
                user32.SetWindowLongPtr(window, GWL_WNDPROC, proc); // Use SetWindowLongPtr if available (64-bit safe)
            } catch (UnsatisfiedLinkError e) {
                user32.SetWindowLong(window, GWL_WNDPROC, proc); // Use SetWindowLong if SetWindowLongPtr isn't available
            }

            // The actual event loop.
            WinUser.MSG msg = new WinUser.MSG();
            while (user32.GetMessage(msg, null, 0, 0) > 0) {
                user32.TranslateMessage(msg);
                user32.DispatchMessage(msg);
            }
        };

        Thread eventLoopThread = new Thread(evenLoopProc, "Win32 Event Loop");
        eventLoopThread.setDaemon(true); // Make the thread a daemon so it doesn't prevent Dashman from exiting.
        eventLoopThread.start();
    }

    private interface User32 extends StdCallLibrary {
        // https://msdn.microsoft.com/en-us/library/windows/desktop/ms632680(v=vs.85).aspx
        WinDef.HWND CreateWindowEx(int dwExStyle, String lpClassName, String lpWindowName, int dwStyle, int x, int y, int nWidth, int nHeight, WinDef.HWND hWndParent, WinDef.HMENU hMenu, WinDef.HINSTANCE hInstance, Pointer lpParam);

        // https://msdn.microsoft.com/en-us/library/windows/desktop/ms633572(v=vs.85).aspx
        WinDef.LRESULT DefWindowProc(WinDef.HWND hWnd, int Msg, WinDef.WPARAM wParam, WinDef.LPARAM lParam);

        // https://msdn.microsoft.com/en-us/library/windows/desktop/ms633591(v=vs.85).aspx
        WinDef.LRESULT SetWindowLong(WinDef.HWND hWnd, int nIndex, StdCallLibrary.StdCallCallback dwNewLong);

        // https://msdn.microsoft.com/en-us/library/windows/desktop/ms644898(v=vs.85).aspx
        WinDef.LRESULT SetWindowLongPtr(WinDef.HWND hWnd, int nIndex, StdCallLibrary.StdCallCallback dwNewLong);

        // https://msdn.microsoft.com/en-us/library/windows/desktop/ms644936(v=vs.85).aspx
        int GetMessage(WinUser.MSG lpMsg, WinDef.HWND hWnd, int wMsgFilterMin, int wMsgFilterMax);

        // https://msdn.microsoft.com/en-us/library/windows/desktop/ms644955(v=vs.85).aspx
        boolean TranslateMessage(WinUser.MSG lpMsg);

        // https://msdn.microsoft.com/en-us/library/windows/desktop/ms644934(v=vs.85).aspx
        WinDef.LRESULT DispatchMessage(WinUser.MSG lpmsg);
    }
}

And now, my usual question: do you think this should be a reusable open source library? would you use it?
 

Advertisements

Book Review: Kettlebell – Simple & Sinister by Pavel Tsatsouline

51Loz+pS70LThis book is almost like a graphic novel, lot’s of pictures (expected) and a big font with lots of padding (not so much). It’s very non-PC, so, if you are easily offended, move on. My review here is of the book and not the program. I still have reasons to believe the program is sound and this book might even be good at teaching how to do the program.

The reason why I’m giving it only one star, is because there’s a lot of pseudo-science and a fair amount of bullshit in this book. Some things are clearly scientifically wrong, others, it’s just some anecdata or something someone said as justification for something.

For example, on page 69, he compares a challenge between a body builder and a marathon runner. First he says the body builder wins, with no data to back it up. Was this experiment run? who participated? what were the results? But what’s even worse, it continues to modify the experiment citing that someone said they would bet on the bodybuilder. I’m probably nitpicking once of the worst offenders and it’s also possible that this story-telling style works well for most people and the data is sound. I understand how story-telling is important, but I also want the data.

★☆☆☆☆

Buy Kettlebell – Simple & Sinister in USA
Buy Kettlebell – Simple & Sinister in UK

My ham radio licensing journey is now over: M0ONP

A friend of my dad introduced me to ham radio when I was 7 years old. When I was 15 or so I passed my beginner’s exam and then I did nothing with it. I got my call sign when I was 24 years old and moving out of Argentina: LU5ARC. I never used it because Argentina is not part of CEPT (and I haven’t gone back except for short holidays).

To get that Argentinean license, I had to take three months of two evenings a week of lessons on theory, Morse code and operating a radio (just making QSOs on 80 meters). I actually collected about 10 QSLs from that time (I wish I knew where they are).

When I moved to the UK almost 7 years ago, I looked into transferring my license but I was told it was impossible. I wish they also told me how easy it was to get a license in the UK and I wouldn’t have waited so long to get started. Last year something else got me interested in radio and I decided to take the plunge and get licensed. I was delighted to see how easy it is.

The hardest part of getting licensed was waiting for the two day course to happen (at that point, I didn’t know about ML&S running them). Because of my previous experience with radio and the fact that I studied electronics and electromechanics in school, there was little to nothing that I didn’t know for the foundation level. Without too much effort I got my first British call sign: M6UON.

Then, I had to wait again and I was thrilled to find that ML&S run foundation and intermediate courses, as well as advanced exams so often. I took the course, pass the exam, and I got my intermediate license: 2E0GGE. A month after that, I took the advanced exam and I now have my full license M0ONP.

Oh… even before there was a foundation course available, I went to the RSGB convention and I took the three exams in a row for the FCC (American) license, so, even before managing to get M6UON, I got an extra (full) one for the US as AC1DM. So ironic!

2018-04-02-15-56-49.jpg

And now the fun begins. I lifted all possible restrictions. I can use the full 100W of my Icom IC-7300 as well as take my Icom ID-51E PLUS2 abroad and use it. I can also supervise unlicensed people so I’ve been introducing all my friends to ham radio. I either have friends that are genuinely interested in this technical hobby that’s going without them knowing about or very good friends that humor me when I spend hours explaining frequency, modulation, SWR, antennas, bandwidth, etc.

If the online world voted, we would have a better world

I’ve seen many cases of this before, but never one as clear as this. Mike Pence, the vice president of the USA, just released a children’s book about a bunny titled “Marlon Bundo’s Day in the Life of the Vice President” and at the same time, John Oliver of Last Week Tonight released a counter-book titled “A Day in the Life of Marlon Bundo“.

How can you make a counter book against a children’s book? Well, Mike Pence is known for being homophobic, for his views that women should not be in the military. Trump even said, regarding talking about gay people “Don’t ask Mike, he wants them all hung”. John Oliver’s book is about gay bunnies getting married. It’s promoting the values that Mike Pence is against.

I’m not a democrat, I’m not a republican, I’m not a feminist (that one is a bit more complex), I’m not gay, I’m not a Tory, I’m not labour, I’m not black. I’m socially liberal, fiscally conservative person. Or something like that. I do believe that tolerance is a good thing, including letting people chose who they love, who they marry, etc. From that point of view I dislike most conservative governments, from Trump’s to the one in the country I live in, the Tories (Theresa May).

I don’t understand how Trump got elected. I do understand why the group of people that voted for Trump did so. There’s a sector of white middle and lower class in the US that feel disenfranchised as their jobs, their way of living, is disappearing. I don’t believe Trump will solve it, but the problem exist and thus people suffering from it were very likely to vote for Trump.

But Trump’s government is anti-gay, anti-black, anti-women and anti many, many other things. All of those demographics surely outweigh the ones voting for him. This is why I don’t understand how Trump got elected. What were all those other people that Trump’s government is against doing on voting day?

Back to the bunny book, look at the reviews for Mike Pence’s book, Marlon Bundo’s Day in the Life of the Vice President:

Marlon Bundo's Day in the Life of the Vice President

Marlon Bundo's Day in the Life of the Vice President - reviews

and now look at the reviews for John Oliver’s book, A Day in the Life of Marlon Bundo:

A Day in the Life of Marlon Bundo

A Day in the Life of Marlon Bundo - reviews

Now, let’s not kid ourselves. All those reviews, for and against both books, by now, are nothing but political commentary. This is political commentary on a neutral website: Amazon. It’s not political commentary on a political site that is likely to have only one side of the argument. And this is happening on other neutral sites as well, such as Goodreads:

John Oliver vs Mike Pence.PNG

By now, this is a popularity contest and a popularity contest that John Oliver is winning by a landslide. A popularity contest in which a story about a gay bunny is winning against the vice president of the United States.

Since an election is nothing else than a popularity contest, where were all those people that are writing reviews on Amazon on voting day? This is a message for everybody, no matter what you believe or what country you are in: get out of your lazy ass and vote!

There are various confounding factors that I want to address:

  • A lot of these reviews might be international and those wouldn’t have an effect on US elections.
  • Reviews are written by people with access to the internet and there might be a high correlation with Internet access and being anti-Trump, gay, lesbian, female, black, liberal. But didn’t Trump win by masterfully using the Internet and social media among other things?
  • John Oliver announced the book last night, so, there might be a pro-John Oliver wave that will die down quickly and in the long run, Mike Pence’s book might prove to be the winner of the popularity contest.

 

 

 

 

 

 

 

Book Review: Leonardo da Vinci by Walter Isaacson

leonardo-da-vinci-9781501139154_hrThis book was fascinating. I always thought of Leonardo Da Vinci as an artist who did other things aside from painting. This book changed my mind. Leonardo saw himself as a philosopher/scientist/engineer (those were sort of one and the same back then) who also paints; and after reading this book, I have to agree.

I think if it wasn’t for the fact that he didn’t publish his findings, he would be the father of modern science. His science/engineering was strongly empirical. He even disregarded religious explanations for things. I am in awe at many of his findings and discoveries. I’m also amaze at his acceptance of his sexuality, even when part of the world was claiming it was evil (to be fair, Florence in that time was sort-of like the liberal capital of the world).

I’m also glad he wasn’t a tortured soul. Yeah, he had his problems, but he seemed to have lived a long good life and that’s rare for people as exceptional as him. Another rare ocurence is that he seemed to have been appreciated in his time (not as much as later, but at least he was no Van Gohg).

I’m listening to the audio book and there’s a PDF companion that you can use to look at the paintings and drawings being described. I rarely find myself in a position to look at them as I listen to audio books while doing chores, driving, running, etc. Nevertheless the descriptions are good enough to appreciate the techniques but not the art obviously.

In the explanations of why Leonardo da Vinci’s paintings were so good I find myself in awe of the techniques he developed for his art. Specially if we consider that just perspective was something not understood very well long before his lifetime. I guess the renaissance was an important time for the development of art (I know, doh!). Something that annoys me is when the author makes subjective comparisons of the art as if they were objective (best painting, best technique, etc). Thankfully, this is not very common in the book.

★★★★☆

Buy Leonardo da Vinci in USA
Buy Leonardo da Vinci in UK

Book Review: Advance! The Full Licence Book by Alan Betts, Steve Hartley

51Go0CzjPlL._SX346_BO1,204,203,200_This book felt of much lower quality than the previous two. There are many typos and editing errors and I noticed a few technical errors as well. I guess it makes sense the advanced saw less scrutiny than the beginner one as fewer people will ever get to this point. Or maybe it’s my bias because this is the first time I really need to learn from the book (the previous two were, mostly, revision of stuff I already knew).

What really annoyed me is that there were many explanations that felt it was missing definitions of terms of explanations of the most basic parts so, aside from memorizing the concepts, it was hard to learn from it.

I’m obviously still grateful that there’s a book that covers the syllabus of the test for the Full License. At the same time, I wish we, in the UK, had more and better material like in the US, where you have the Extra Class License Manual, a thick 496-pages long nice book, and the excellent Gordon West’s Extra Class 2012-2016, as well as one or two video courses on YouTube covering all the material.

Giving the the physics is the same for the US and the UK, and that the ham radio hobby is having trouble with not having enough people and resources, it would be nice to share more things across countries. I understand the regulations are different and complex, but still, the actual radio stuff could be exactly the same in the US, UK and many other countries.

★★☆☆☆

Buy Advance! The Full Licence Book

The Omnivore’s Dilemma: A Natural History of Four Meals by Michael Pollan

omnivores_dilemma_by_michael_pollan1So far the tone of this book is disgustingly hippish. I think it presents some interesting data, but the way it presents it is so annoying:

– everything modern is bad
– everything mainstream is bad
– the only good alternative is primitive farms
– food and nature is a mystery that we cannot grasp so all efforts to synthesize fertilizers, pesticides, etc are doom to fail
– the natural cycle of chickens, cows, pigs, etc is perfect and shouldn’t be tampered with (mind you, these animals are almost as artificial as computers these days).

The part that annoys me the most is how it attributes negative connotations to the term agrobusiness. The definition of that word is “the businesses collectively associated with the production, processing, and distribution of agricultural products”, so, his idyllic small farms are as much agrobusinesses as the Monsatos he criticizes.

Another example I found ridiculous is when a farmer would refuse to ship him some food because burning fossil fuels to deliver his product was against his principles and instead told him: “If you want to try it, you’ll have to drive here”. Guess what! Driving to a location burns more fossil fuels than shipping a small package through highly efficient delivery companies (unless you drive an electric car and even then, I’m not sure).

I understand if the recommendations of the author were for an individual but he often talks about society as a whole without exploring the economic implications of using much more manual labor to produce food: can we actually feed the world with traditional farms? I don’t know and I have an inkling that the answer is probably very complex and not explored a lot in this book that advocates everybody to eat from those traditional farms.

★☆☆☆☆

Buy The Omnivore’s Dilemma: A Natural History of Four Meals in USA
Buy The Omnivore’s Dilemma: A Natural History of Four Meals in UK
Buy The Omnivore’s Dilemma: A Natural History of Four Meals in Canada

Book Review: Intermediate Licence – Building On The Foundation by Steve Hartley

s-l640I’m not a good person to judge this book because I not only have a technical background in electronics, I also got my American Extra-level license (AC1DM) before this one, so, I had to study all this material a few months ago. This feel like a revision.

Something that really surprises me about the book is that it says the ionosphere reflects radio waves. I understand we use that word in casual speech but I believe a book on ham radio should be more strict and use the correct term: refraction.

For whatever it matters, I passed the exam with a 43 out of 45 questions answered correctly.

★★★☆☆

Buy Intermediate Licence – Building On The Foundation

Book Review: American Prometheus: The Triumph and Tragedy of J. Robert Oppenheimer by Kai Bird, Martin J. Sherwin

80571For this review I’m considering, without any fact checking or cross referencing, that this biography is factual and true to the events although clearly some of the statements in the book would be hard to evaluate as they describe the feelings of large groups of people.

I knew a bit about The Manhattan Project and it was fun to have another take on those years of science, innovation and destruction. What I didn’t know is what happened before and after in the life of Oppenheimer.

During the earlier years, I was surprised by how active Oppenheimer and other people were in the projects of the communist party. It sounds as during those days, for many Americans, it wasn’t the enemy’s ideology but a potential solution to their ongoing socioeconomic problems. Some glorified the Soviet Union before they knew and understood how tyrannical it was. I can’t begin to fathom at the absurdity of the witch hunt that was McCarthyism and what a negative force it excreted on the American scientific society. I can’t help but notice the parallel with the trial against Alan Turing.

What surprised me the most about what I read in this book was Oppenheimer’s transformation. You could never guess that the boy and young man described in the early chapters could ever become a leader of scientists, a pragmatic that could put a practical goal above the intrinsic curiosity that pushes people into science and achieve so much. I guess the fear of a Nazi world was a great motivator.

★★★★☆

Buy American Prometheus: The Triumph and Tragedy of J. Robert Oppenheimer in USA
Buy American Prometheus: The Triumph and Tragedy of J. Robert Oppenheimer in the UK
Buy American Prometheus: The Triumph and Tragedy of J. Robert Oppenheimer in Canada

Book Review: Life in the United Kingdom: A Guide for New Residents by Great Britain Home Office

81DKEZAB9NLThe only real way to judge this book is whether it helps you pass the Life in the United Kingdom test or not and I don’t yet know that. I’ve read the book (it actually took me one full day to go through all of it) and I’m probably going to re-read at least once, but for my actual study I’m using the mock tests at: https://lifeintheuktests.co.uk/life-i… I’ve found many sources of mock tests, but that one seems to have the hardest questions and I personally know someone that passed the test studying from there.

Judging the book by itself, I found it terrible. There’s two reasons for that:
– It’s written for the lowest level of English that would allow you to become a citizen, so, the prose is terse and simple.
– It’s designed to cover just the information you need to pass the test and nothing more, so, it’s almost a regurgitation of facts.

About the last point, for some bits of history that I know a bit about and that are super interesting (WWI, WWII, Scotland’s joining the UK, and a few more) I found the book super boring and skipping all the interesting bits just because it’s not in the exam. It makes sense for this book but it makes for a boring book. I have to admit that it made me curious about some things that I want to read more about and also some places I want to visit now.

★☆☆☆☆

Buy Life in the United Kingdom: A Guide for New Residents in USA
Buy Life in the United Kingdom: A Guide for New Residents in the UK
Buy Life in the United Kingdom: A Guide for New Residents in Canada