改变win2k默认登录名(附原码)

你是用win2k吗?每次重新启动以后,默认的登录的名就是你上一次用的。可是如果你上一次用的Administrator,每次还要改回普通用户(为了防毒和安全)好麻烦;或者你不想让其他人知道你登录过这台电脑(嘿嘿我窃取了你的QQ聊天记录……),怎么修改默认的登录用户呢?

这个小程序就是干这个的了。把它的图标拉到开始菜单的启动组里,修改快捷方式,在命令行后加上你要更改的默认登录名即可

比如:
c:/winnt/chglogon.exe flywhc

然后你用Administrator登录,然后再重新启动或者注销试试看?

附送原代码及工程文件。编译后体积 16K。但显然,如果用汇编可以做到更小。

我对减小编译后体积很感兴趣,如果有人能把这个VC做的程序编译后的体积再减小1K以上(不用任何第三方软件压缩),给我发EMAIL,我在VC版给你200分。

================= chglogon.dsp ============================

# Microsoft Developer Studio Project File - Name="chglogon" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **

# TARGTYPE "Win32 (x86) Application" 0x0101

CFG=chglogon - Win32 Release
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "chglogon.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "chglogon.mak" CFG="chglogon - Win32 Release"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "chglogon - Win32 Release" (based on "Win32 (x86) Application")
!MESSAGE

# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /Yu"stdafx.h" /FD /c
# ADD CPP /nologo /W4 /GX /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /FD /c
# SUBTRACT CPP /YX /Yc /Yu
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x804 /d "NDEBUG"
# ADD RSC /l 0x804 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
# ADD LINK32 advapi32.lib kernel32.lib /nologo /entry:"WinMain" /subsystem:windows /machine:I386 /nodefaultlib
# Begin Target

# Name "chglogon - Win32 Release"
# Begin Group "Source Files"

# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File

SOURCE=./chglogon.cpp
# End Source File
# End Group
# Begin Group "Header Files"

# PROP Default_Filter "h;hpp;hxx;hm;inl"
# End Group
# Begin Group "Resource Files"

# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project

============== End =====================

============== chglogon.cpp ===============

#include <windows.h>

int APIENTRY WinMain(HINSTANCE hInstance,
                     HINSTANCE hPrevInstance,
                     LPSTR     lpCmdLine,
                     int       nCmdShow)
{
 hInstance=hInstance;
 hPrevInstance=hPrevInstance;
 nCmdShow=nCmdShow;
 lpCmdLine=GetCommandLine();
 HKEY hKey;
 char szBuf[255]={0},*p=lpCmdLine;
 p++;
 if(*p=='/"'){
  while(*p!='/"' && *p!=0){
   p++;
  }
 }else{
  while(*p!=' ' && *p!=0){
   p++;
  }
 }
 p++;
 int i=0;
 while(*p){
  szBuf[i++]=*p;
  p++;
  if(*p==' ') break;
 }
 *p=0;
 ::RegOpenKeyEx(HKEY_LOCAL_MACHINE,"SOFTWARE//Microsoft//Windows NT//CurrentVersion//Winlogon",0,KEY_SET_VALUE,&hKey);
 ::RegSetValueEx(hKey,"DefaultUserName",0,REG_SZ,(CONST BYTE *)szBuf,i);
 ::RegSetValueEx(hKey,"AltDefaultUserName",0,REG_SZ,(CONST BYTE *)szBuf,i);
 ::RegCloseKey(hKey);
 return 0;
}

=============== End =======================

 

  • 0
    点赞
  • 1
    评论
  • 0
    收藏
  • 一键三连
    一键三连
  • 扫一扫,分享海报

©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值