Zune 30Gb Bug Sourcecode

As you may have heard, all 30Gb Zune’s refused to work on December 31st 2008 due to a bug in the internal clock driver related to the way the device handles a leap year.

Somehow, the sourcecode to the RTC clock driver code has appeared on the internet. The code itself was written by Freescale Semiconductor though, not Microsoft.

The problematic code seems to start on line 249:

//------------------------------------------------------------------------------
//
// Function: ConvertDays
//
// Local helper function that split total days since Jan 1, ORIGINYEAR into
// year, month and day
//
// Parameters:
//
// Returns:
// Returns TRUE if successful, otherwise returns FALSE.
//
//------------------------------------------------------------------------------
BOOL ConvertDays(UINT32 days, SYSTEMTIME* lpTime)
{
int dayofweek, month, year;
UINT8 *month_tab;

//Calculate current day of the week
dayofweek = GetDayOfWeek(days);

year = ORIGINYEAR;

while (days > 365)
{
if (IsLeapYear(year))
{
if (days > 366)
{
days -= 366;
year += 1;
}
}
else
{
days -= 365;
year += 1;
}
}

// Determine whether it is a leap year
month_tab = (UINT8 *)((IsLeapYear(year))? monthtable_leap : monthtable);

for (month=0; month<12; month++)
{
if (days <= month_tab[month])
break;
days -= month_tab[month];
}

month += 1;

lpTime->wDay = days;
lpTime->wDayOfWeek = dayofweek;
lpTime->wMonth = month;
lpTime->wYear = year;

return TRUE;
}

Basically, December 31st was being qualified as a day > 365 (Which is correct, it was day 366 as 2008 was a leap year). The bug is that the code only checks for days > 366, not = 366. The poor Zune’s were getting stuck in the while loop until January 1st when they could finally break out.

BT limiting BitTorrent speed

For the last month or so my ISP, British Telecom, have been limiting BitTorrent download speeds (upload speeds have remained unaffected).

When I signed up with them I quizzed their sales people about what traffic shaping technology they employed and whether they used bitfield mangling or similar technologies. They said no, it was a truly unlimited service. Despite numerous calls to their support department (who aren’t technical and just ask you to reset your router) I’ve given up the battle of getting them to at least confirm what they’re doing.

Without any workarounds on my end, torrent downloads were limited to about 55kb/s - A real pain if you’re trying to download some of Simon’s VMWare images.

Thankfully it turned out to be quite simple to get around BT’s traffic shaping system. Enabling RC4 encryption on all the torrent connections was sufficient to up my download speed to about 800kb/s. RC4 not only encrypts the headers but the entire data stream. The only downside is that it requires more CPU time to decrypt the traffic.

Assuming you’re using Vuze (formally Azureus), here are the simple steps you need to take:

  1. Go to: Vuze > Preferences.
  2. Expand Connection > Transport Encryption.
  3. Check “Require encrypted transport”.
  4. Set the “Minimum encryption level” dropdown to RC4.
  5. Tick the “Allow non-encrypted outgoing connections” checkbox (to enable compatibility with peers not supporting encryption).
  6. Tick the “Allow non-encrypted incoming connections” checkbox.

After a minute or so your transfer speeds should jump to about 600kb/s. The ball’s back in your court, BT.

Removing a child domain that no longer exists

I was asked to remove a child domain at work today. Usually that wouldn’t be a problem but unfortunately the final DC had been wiped and not been dcpromo’d (Cleanly removed from the domain).

So I thought I’d document the process should anyone else find themselves in a similar situation. To do most of the below, you’ll need to be an Enterprise Admin.

  1. Remove all the DNS entries for the missing DCs and the child domain. Make sure you get the GUID entries too.
  2. Fire up ntdsutil and follow the below steps. When you select a server to connect to, connect to the operation master.
    ntdsutil: metadata cleanup
    metadata cleanup:
    metadata cleanup: connections
    server connections:
    server connections: connect to server london.nwtraders.msft
    Binding to london …
    Connected to london using credentials of locally logged on user
    server connections:
    server connections: quit
    metadata cleanup:
    metadata cleanup: select operation target
    select operation target:
    select operation target: list domains
    Found 2 domain(s)
    0 - DC=nwtraders,DC=msft
    1 - DC=child,DC=nwtraders,DC=msft
    select operation target:
    select operation target: select domain 1
    No current site
    Domain - DC=child,DC=nwtraders,DC=msft
    No current server
    No current Naming Context
    select operation target:
    select operation target: quit
    metadata cleanup:
    metadata cleanup: remove selected domain

    Depending on the exact situation, you may get an error about needing to remove a server first (Sorry, I can’t recall the exact error). If you do, there’s an extra step you need to undertake first.

    ntdsutil: metadata cleanup
    metadata cleanup:
    metadata cleanup: connections
    server connections:
    server connections: connect to server london.nwtraders.msft
    Binding to london …
    Connected to london using credentials of locally logged on user
    server connections:
    server connections: quit
    metadata cleanup:
    metadata cleanup: select operation target
    select operation target:
    select operation target: list sites
    Found 1 site(s)
    0 - CN=Default-First-Site-Name,CN=Sites,CN=Configuration,DC=nwtraders,DC=msft
    select operation target:
    select operation target: select site
    Site - CN=Default-First-Site-Name,CN=Sites,CN=Configuration,DC=nwtraders,DC=msft
    No current domain
    No current server
    No current Naming Context
    select operation target:
    select operation target: list servers in site
    Found 1 server(s)
    0 - CN=brisbane,CN=Servers,CN=Default-First-Site-Name,CN=Sites,CN=Configuration,DC=nwtraders,DC=msft
    select operation target: select server 0

    Then repeat the first process to remove the server (remove selected server).

  3. Open up Active Directory Sites And Services and remove any stranded servers.
« Older Entries