• force reset to the version of the last two 取消当前版本之前的两次提交
git reset --hard HEAD~2 
  • force push to the remote re 强制提交到远程版本库,从而删除之前的两次提交数据
git push origin HEAD --force
标签: git
日期: 2014-06-20 17:30:06, 10 years and 210 days ago

获取windows网络状态有三种方式:

  • InternetGetConnectedState(wininet.dll)直接获取

  • GetAdaptersAddresses(iphlpapi.dll)枚举网络适配器

  • Network Awareness

    • NLA in Windows XP

    • NLM in Vista or windows 7

源代码 source code

netaware - https://raw.githubusercontent.com/codepongo/utocode/master/windows/netaware.cpp

  • with iphlp - webkit的GetAdaptersAddresses方式的实现 webkit implementation
  • with nlm - NLM的同步实现 NLM synchronous implementation
  • with nlm event - NLM的异步实现 NLM asynchronous implementation
  • with wininet - InternetGetConnectedState的实现 InternetGetConnectedState implementation
  • with winsock - NLA的同步实现 NLA synchronous implementation
  • wait for change with winsock - NLA的异步实现 NLA asynchronous implementation
  • GetAdaptersAddresses方式的更准确实现可参考firefox的源码
    • 如果确定不了网络是否连接(如API失败等情况),则返回已连接状态
    • 通过获取AdapaterAddress AdapaterInfo和IPAddressTable进行综合判断
    • 通过NotifyAddrChange(http://msdn.microsoft.com/en-us/library/windows/desktop/aa366329.aspx)异步通知 伪代码如下:
def CheckAdapterAddress():
    addresses = GetAdaptersAddresses()
    for a in addresses:
        if a.OperStatus == IfOperStatusUp 
        and a.IfType != IF_TYPE_SOFTWARE_LOOPBACK
        and a.FirstUnicastAddress->Address.lpSockaddr != '192.168.0.1':
            return True;
    return False

def CheckAdaptersInfo():
    adapters = GetAdaptersInfo()
    for a in adapters:
        if a.DhcpEnabled:
            if a.DhcpServer.IpAddress == '255.255.255.255':
                return True;
            else:
                for ip in a.IpAddressList:
                    if ip == '0.0.0.0':
                        return True;
        return False;

def CheckIPAddrTable():
    tables = GetIpAddrTable()
    for t in tables:
        if t.dwAddr != 0 && t.dwAddr !=  0x0100007F:
            return True
    return False

reference 参考

标签: windows, webbrowser
日期: 2014-06-12 17:30:06, 10 years and 218 days ago
  • create a file and name it "desktop.scf" 新建名为“desktop.scf“的文件

  • copy bellow content in it 复制下面内容到文件中

[Shell]
Command=2
IconFile=%SystemRoot%system32SHELL32.dll,34
[Taskbar]
Command=ToggleDesktop
  • create a shortcut and move it into the "~\favorites\links" 创建一个快捷方式并拷贝到用户目录下的favorites\links下 ~ belongs to your home directory
标签: windows
日期: 2014-06-06 17:30:06, 10 years and 224 days ago

menu: Debug - New Breakpoint(ctrl+B) vs菜单:调试 - 新断点(ctrl+B)

Function:{,,dynamic.dll}_functionW@size
e.g.
{,,kernel32.dll}_CreateProcessW@40
  • dynamic is the DLL name dynamic为DLL名称
  • NOTICE there is a underline at the front of 'function' 注意函数名前有下划线
  • function is the function name function为函数名
  • W/A is ascii or unicode function W/A为区别windows API的ascii和unicode版
  • size is the size of all arguments of the function, more size为函数所有参数的字节数,详细

for example 例如:

int
WINAPI
MessageBoxW(
    __in_opt HWND hWnd,
    __in_opt LPCWSTR lpText,
    __in_opt LPCWSTR lpCaption,
    __in UINT uType);
size = sizeof(HWND) + sizeof(LPCWSTR) + sizeof(LPCWSTR) + sizeof(UINT)

或者 or

C:\Program Files (x86)\Debugging Tools for Windows (x86)>dbh.exe -s:srv*C:\Symbo
ls*http://msdl.microsoft.com/Download/Symbols -d C:\Windows\SysWOW64\user32.dl
l enum *MessageBox*

so, the breakpoint at the 'messagebox' function is 所以,messagebox函数的断点function应添为

{,, User32.dll}_MessageBoxW@16

reference 参考

break point on create process

rule for function name

标签: windows
日期: 2014-05-30 17:30:06, 10 years and 231 days ago

原文

  • 强制将当前目录下的所有文件及文件夹、子文件夹下的所有者更改为管理员组(administrators)命令:
takeown /f * /a /r /d y
  • 将所有当前目录下的文件、子文件夹的NTFS权限修改为仅管理员组(administrators)完全控制(删除原有所有NTFS权限设置):
cacls * /T /G administrators:F
  • 在原有当前目录下的文件、子文件夹的NTFS权限上添加管理员组(administrators)完全控制权限(并不删除原有所有NTFS权限设置):
cacls * /T /E /G administrators:F
  • 取消管理员组(administrators)完全控制权限(并不删除原有所有NTFS权限设置):
cacls \\Server\path /t /e /r "mddq\domain admins"
cacls \\Server\path /t /e /r "mddq\domain admins"
标签: windows
日期: 2014-04-04 17:30:06, 10 years and 287 days ago