Tips & Tricks Blog
Notes, ideas and general comments on anything related to high-tech.

June 4, 2018

Microsoft OneNote Sign In Fix

Filed under: Web, Windows

After installing the OneNote 2016 PC client it asks you to sign in to the cloud.
If it decides that you have to use a business account (i.e. you are trying to set it up on a PC that is a part of a domain), but you need to use your personal account it is going to complain. It will either say that your email address’ domain isn’t known, your account does not exist/not found or it doesn’t look like work or school e-mail.

The following registry change will make it accept a personal account. First exit OneNote app, then change the value in the HKEY_CURRENT_USER\Software\Microsoft\Office\16.0\OneNote\FirstBootStatus key to hexadecimal 2000202.

April 30, 2009

ICMP Over Raw Sockets Under Windows Vista

Filed under: Windows — Tags: , , ,

Microsoft has changed how the raw sockets behave several times throughout their OS release history. Starting from XP SP2 the transmissions through raw sockets are limited to prevent sending hand crafted frames of particular types (TCP, UDP with foreign source addresses, …) on client family of OSes. Fortunately the ICMP frames can still be sent and the applications that were using ICMP and  raw sockets are still compatible or easily portable to various Windows OSes.

The only reasonable alternative to the raw sockets when it comes to working with ICMP under Windows is to use the ICMP API DLL. That method is acceptable for simple use cases, but does not allow customizations or fine control over what is transmitted and received. If an application has to manage TTL, payload and types of the ICMP messages, examine the responses, needs to be portable or is built around winsock  for all other operations the ICMP API is not an acceptable or desired choice. 

The problem is that starting from Windows Vista the applications that under XP would successfully receive ICMP responses like “Destination Unreachable” or “TTL Expired” no longer see them. In order for such applications to work correctly under Windows Vista small adjustments have to be made. The following code snippet shows how to set up a raw socket under Vista to assure that it receives frames as it used to do under Windows XP or 2K.

/* Get the address of the interface to work with (using the first one found here) */
hostent *host_addr_list = gethostbyname(NULL);
if(host_addr_list == NULL)
  /* Handle error here */
  src.sin_addr.S_un.S_addr = *((u_long *)(host_addr_list->h_addr_list[0]));

/* Bind the socket */
if(bind(s, (sockaddr *)&src, sizeof(src)) != NO_ERROR)
  /* Handle error here */

/* Run the IOCTL that disables packet filtering on the socket. */
DWORD tmp, prm = 3; /* "RCVALL_IPLEVEL" (Vista SDK) */
if(WSAIoctl(s, SIO_RCVALL, &prm, sizeof(prm), NULL, 0,
            &tmp, NULL, NULL) == SOCKET_ERROR)
  /* Handle error here */

Note that you have to bind the socket to a specific interface address. This is required for the RCVALL_IPLEVEL IOCTL to work.

Home Tips & Tricks Blog
Powered by WordPress