I am a Software Development Engineer in Test working for the Windows Sound team. You can contact me via email: mateer at microsoft dot com
Friend key: 28904932216450_59cd9d55374be03d8167d37c8ff4196b
Here are the portions of my unattend.xml file which are needed to turn on Remote Desktop automatically.
This piece flips the "no remote desktop" kill switch to "allow."
<settings pass="specialize"> ... <component name="Microsoft-Windows-TerminalServices-LocalSessionManager" ...> <fDenyTSConnections>false</fDenyTSConnections>
That's not enough; it is also necessary to poke a hole in the firewall to allow inbound connections. I use an indirect string for the Group name, to allow for installing localized builds. This points to the "Remote Desktop" feature group.
<settings pass="specialize"> ... <component name="Networking-MPSSVC-Svc" ...> <FirewallGroups> <FirewallGroup wcm:action="add" wcm:keyValue="RemoteDesktop"> <Active>true</Active> <Profile>all</Profile> <Group>@FirewallAPI.dll,-28752</Group>
If your user account is a member of the "Administrators" group, you're done:
<settings pass="oobeSystem"> <component name="Microsoft-Windows-Shell-Setup" ...> <UserAccounts> <LocalAccounts> <LocalAccount wcm:action="add"> <Password> <Value>#PASSWORD_ADMIN#</Value> <PlainText>true</PlainText> </Password> <Name>Admin</Name> <Group>Administrators</Group>
But if you're like me and you don't want to live in the Administrators group, you need to join the Remote Desktop Users group to be able to log in remotely:
<settings pass="oobeSystem"> <component name="Microsoft-Windows-Shell-Setup" ...> <UserAccounts> <DomainAccounts> <DomainAccountList wcm:action="add"> <Domain>redmond.corp.microsoft.com</Domain> <DomainAccount wcm:action="add"> <Group>RemoteDesktopUsers</Group> <Name>MatEer</Name>
This shows how to call waveInGetNumDevs, waveInGetDevCaps, waveOutGetNumDevs, and waveOutGetDevCaps.
// main.cpp
#include <windows.h>#include <mmsystem.h>#include <stdio.h>
#define LOG(format, ...) wprintf(format L"\n", __VA_ARGS__)
int _cdecl wmain() {
UINT devs = waveInGetNumDevs(); LOG(L"waveIn devices: %u", devs); for (UINT dev = 0; dev < devs; dev++) { WAVEINCAPS caps = {}; MMRESULT mmr = waveInGetDevCaps(dev, &caps, sizeof(caps)); if (MMSYSERR_NOERROR != mmr) { LOG(L"waveInGetDevCaps failed: mmr = 0x%08x", mmr); return mmr; } LOG( L"-- waveIn device #%u --\n" L"Manufacturer ID: %u\n" L"Product ID: %u\n" L"Version: %u.%u\n" L"Product Name: %s\n" L"Formats: 0x%x\n" L"Channels: %u\n" L"Reserved: %u\n" , dev, caps.wMid, caps.wPid, caps.vDriverVersion / 256, caps.vDriverVersion % 256, caps.szPname, caps.dwFormats, caps.wChannels, caps.wReserved1 ); }
devs = waveOutGetNumDevs(); LOG(L"waveOut devices: %u", devs); for (UINT dev = 0; dev < devs; dev++) { WAVEOUTCAPS caps = {}; MMRESULT mmr = waveOutGetDevCaps(dev, &caps, sizeof(caps)); if (MMSYSERR_NOERROR != mmr) { LOG(L"waveOutGetDevCaps failed: mmr = 0x%08x", mmr); return mmr; } LOG( L"-- waveOut device #%u --\n" L"Manufacturer ID: %u\n" L"Product ID: %u\n" L"Version: %u.%u\n" L"Product Name: %s\n" L"Formats: 0x%x\n" L"Channels: %u\n" L"Reserved: %u\n" L"Support: 0x%x\n" L"%s%s%s%s%s" , dev, caps.wMid, caps.wPid, caps.vDriverVersion / 256, caps.vDriverVersion % 256, caps.szPname, caps.dwFormats, caps.wChannels, caps.wReserved1, caps.dwSupport, ((caps.dwSupport & WAVECAPS_LRVOLUME) ? L"\tWAVECAPS_LRVOLUME\n" : L""), ((caps.dwSupport & WAVECAPS_PITCH) ? L"\tWAVECAPS_PITCH\n" : L""), ((caps.dwSupport & WAVECAPS_PLAYBACKRATE) ? L"\tWAVECAPS_PLAYBACKRATE\n" : L""), ((caps.dwSupport & WAVECAPS_VOLUME) ? L"\tWAVECAPS_VOLUME\n" : L""), ((caps.dwSupport & WAVECAPS_SAMPLEACCURATE) ? L"\tWAVECAPS_SAMPLEACCURATE\n" : L"") ); }
return 0;}
On my system this outputs:
waveIn devices: 3-- waveIn device #0 --Manufacturer ID: 1Product ID: 65535Version: 0.0Product Name: Microphone (High Definition AudFormats: 0xfffffChannels: 2Reserved: 0
-- waveIn device #1 --Manufacturer ID: 1Product ID: 65535Version: 0.0Product Name: Digital Audio (S/PDIF) (High DeFormats: 0xfffffChannels: 2Reserved: 0
-- waveIn device #2 --Manufacturer ID: 1Product ID: 65535Version: 0.0Product Name: CD Audio (High Definition AudioFormats: 0xfffffChannels: 2Reserved: 0
waveOut devices: 2-- waveOut device #0 --Manufacturer ID: 1Product ID: 65535Version: 0.0Product Name: Headphones (High Definition AudFormats: 0xfffffChannels: 2Reserved: 0Support: 0x2e WAVECAPS_LRVOLUME WAVECAPS_PLAYBACKRATE WAVECAPS_VOLUME WAVECAPS_SAMPLEACCURATE
-- waveOut device #1 --Manufacturer ID: 1Product ID: 65535Version: 0.0Product Name: Digital Audio (S/PDIF) (High DeFormats: 0xfffffChannels: 2Reserved: 0Support: 0x2e WAVECAPS_LRVOLUME WAVECAPS_PLAYBACKRATE WAVECAPS_VOLUME WAVECAPS_SAMPLEACCURATE
Source and binaries attached.
As many people, I have to deal with a lot of numbers all the time (bug numbers, changelist numbers, tracking numbers, ...) and as a mathematician I sometimes notice when numbers have peculiar properties.
For example, I recently ran into 152463, which is a straight (made up of consecutive digits, not necessarily in order.) I then ran into 35426, which is also a straight. Is this odd?
To put it another way - what proportion of numbers are straights?
We consider only non-negative integer numbers {0, 1, 2, ... }. No duplicate digits are allowed, so the very last straight is 9,876,543,210.
Break it down by the length of the number in digits. For example, how many four-digit numbers are there? We can choose any number from 1-9 for the first digit, and any number from 0-9 for each of the other three digits; so there are 9 * 103 numbers of length 4.
How many of these are straights? There are seven ways to choose a set of four consecutive digits to make up a four-digit straight: {0,1, 2, 3}, {1, 2, 3, 4}, {2, 3, 4, 5}, {3, 4, 5, 6}, {4, 5, 6, 7}, {5, 6, 7, 8}, {6, 7, 8, 9}.
Each of these seven ways can then be shuffled to make the straights themselves. For six of these seven sets of digits, all possible shufflings are allowed; there are 4! shufflings for each set. This gives 6 * 4! straights.
But for {0, 1, 2, 3}, we have to be careful not to end up with 0 as a leading digit. We choose the leading digit first out of the set {1, 2, 3} (there are three ways to do this) and then we have complete freedom to shuffle the three remaining digits (including 0.) This gives 3 * 3! straights.
So there are 6 * 4! + 3 * 3! straights which are four digits long.
Considering all possible lengths from 1 to 10 (we'll consider 0 as a number of length 1) gives the following table:
Since roughly 1% of five-digit numbers are straights, it is not surprising that I see them that often.
As a tester on Windows 8 I install Windows on my dev machine very frequently.
I use F12 to boot from the network into WinPE, then I run a .bat file which looks something like this:
@echo offsetlocal enabledelayedexpansionset PASSWORD_ADMIN=(redacted)set PASSWORD_MATEER=(redacted)set LICENSE_KEY=(redacted)set FANCYLANG=qps-plocmdel unattend-processed.xmlfor /f "usebackq delims=" %%l in (`type unattend-template.xml`) do ( set line=%%l set line=!line:#PASSWORD_ADMIN#=%PASSWORD_ADMIN%! set line=!line:#PASSWORD_MATEER#=%PASSWORD_MATEER%! set line=!line:#LICENSE_KEY#=%LICENSE_KEY%! set line=!line:#FANCY_LANG#=%FANCY_LANG%! echo !line! >> unattend-processed.xml)setup.exe /unattend:unattend-processed.xml
This takes my template unattend.xml file, injects various parameters, and calls setup.exe.
The template unattend.xml follows in all of its glory. We'll take a closer look at some of the things in future posts.
<?xml version="1.0" encoding="utf-8"?><unattend xmlns="urn:schemas-microsoft-com:unattend"> <settings pass="windowsPE"> <component name="Microsoft-Windows-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <UserData> <ProductKey> <WillShowUI>OnError</WillShowUI> <Key>#LICENSE_KEY#</Key> </ProductKey> <AcceptEula>true</AcceptEula> <FullName>Matthew van Eerde</FullName> <Organization>Microsoft</Organization> </UserData> <DiskConfiguration> <Disk wcm:action="add"> <CreatePartitions> <CreatePartition wcm:action="add"> <Order>1</Order> <Extend>true</Extend> <Type>Primary</Type> </CreatePartition> </CreatePartitions> <WillWipeDisk>true</WillWipeDisk> <DiskID>0</DiskID> </Disk> </DiskConfiguration> <ImageInstall> <OSImage> <WillShowUI>OnError</WillShowUI> <InstallToAvailablePartition>true</InstallToAvailablePartition> </OSImage> </ImageInstall> </component> <component name="Microsoft-Windows-International-Core-WinPE" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <SetupUILanguage> <UILanguage>#FANCY_LANG#</UILanguage> </SetupUILanguage> <InputLocale>0409:00000409</InputLocale> <UserLocale>en-US</UserLocale> <SystemLocale>en-US</SystemLocale> <UILanguage>#FANCY_LANG#</UILanguage> </component> </settings> <settings pass="specialize"> <component name="Microsoft-Windows-UnattendedJoin" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <Identification> <Credentials> <Domain>redmond.corp.microsoft.com</Domain> <Password>#PASSWORD_MATEER#</Password> <Username>MatEer</Username> </Credentials> <JoinDomain>ntdev.corp.microsoft.com</JoinDomain> </Identification> </component> <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <ComputerName>MATEER-Q</ComputerName> <RegisteredOwner>Matthew van Eerde</RegisteredOwner> <RegisteredOrganization>Microsoft</RegisteredOrganization> </component> <component name="Microsoft-Windows-TerminalServices-LocalSessionManager" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <fDenyTSConnections>false</fDenyTSConnections> </component> <component name="Networking-MPSSVC-Svc" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <FirewallGroups> <FirewallGroup wcm:action="add" wcm:keyValue="RemoteDesktop"> <Active>true</Active> <Profile>all</Profile> <Group>@FirewallAPI.dll,-28752</Group> </FirewallGroup> </FirewallGroups> </component> </settings> <settings pass="oobeSystem"> <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <OOBE> <HideEULAPage>true</HideEULAPage> <NetworkLocation>Work</NetworkLocation> <ProtectYourPC>3</ProtectYourPC> <HideOnlineAccountScreens>true</HideOnlineAccountScreens> <HideLocalAccountScreen>true</HideLocalAccountScreen> <HideWirelessSetupInOOBE>true</HideWirelessSetupInOOBE> </OOBE> <UserAccounts> <LocalAccounts> <LocalAccount wcm:action="add"> <Password> <Value>#PASSWORD_ADMIN#</Value> <PlainText>true</PlainText> </Password> <Name>Admin</Name> <Group>Administrators</Group> </LocalAccount> </LocalAccounts> <DomainAccounts> <DomainAccountList wcm:action="add"> <Domain>redmond.corp.microsoft.com</Domain> <DomainAccount wcm:action="add"> <Group>RemoteDesktopUsers</Group> <Name>MatEer</Name> </DomainAccount> </DomainAccountList> </DomainAccounts> </UserAccounts> <TimeZone>Pacific Standard Time</TimeZone> <AutoLogon> <Password> <Value>#PASSWORD_MATEER#</Value> <PlainText>true</PlainText> </Password> <Domain>redmond.corp.microsoft.com</Domain> <Enabled>true</Enabled> <LogonCount>1</LogonCount> <Username>MatEer</Username> </AutoLogon> </component> </settings></unattend>