Monday, March 26, 2012

割草机打不着火?您进来,我告诉您

今天我一位邻居又在那里嘎啦嘎啦地拉绳子 ---- 割草机打火打不着!我发现别说中国人极少有人知道个中奥妙,就连从小都用割草机的老美也绝大多数不清楚。




今天我告诉您非常简易的办法。您不需要懂得发动机,不需要有很多肌肉,甚至不需要您是个男人,老太太小姑娘都能轻易地让割草机点火成功。



您可别说俺在忽悠。这里说的可不是电动割草机,那要拉着很长的电线,而是汽油发动机带动的割草机。不论是手扶跟着走的,还是您坐在上面的,只要是汽油发动机带动的,都有打火难的问题。



先看图。






上面的图是我在地下室的窗台上照的。这个东东在任何汽车零件店都有卖的,在 Sears 店、我二妈店、 Kmart 店等等都有卖的,几美刀而已。它是什么东东呢?跟您说,它就是把燃油(天然气、乙烯乙炔类的甚至汽油)变成气体,喷雾出来。



操作:



下面的图中您看到那跟电线就是油门线。它的下面大的长方形盒子就是汽油箱,上面右边小一点的长方形盒子是空气过滤器。空气从过滤器的底部进入,这样,防止下雨时水进入气缸。空气过滤器里边是海棉,外面一个铁盒子把海棉包住,下面让空气进入到气缸。


把图一的气体燃油喷一下,就喷在过滤器底下有胶皮圈上面的那个地方,然后立刻去拉那根绳子,一拉,您喷的气体燃油就进入气缸,发动机立刻着火转动起来了。



那您要问:是不是要两个人操作,一个人拉绳子另一个人喷?答案是否定的。您喷完后,一点点气体燃油就足够把发动机打着了。别忘了,拉绳子时要把那个把手下面的铁丝与把手攥在一起,因为那个铁丝是开关。一旦松开,立刻死火。



不需要用很大的力气就能一次打火成功!女人也可以自己割草的。您看第二个图上右边有个橡皮的半圆,那是您给发动机里边注射汽油的。说明书告诉您需要按 4 下左右然后拉绳子打火。有了我上面的办法,您不需要动那个橡皮,不需要给发动机里打入液体燃油。



我的邻居告诉我,他每三年就要换一台新的割草机!因为三年后的割草机打不着火。我告诉他我这个割草机21 年了,风风雨雨,从来我都没有保养过它一次!油门已经不能动了,这个更好了,反正只是在打火时需要大油门,一旦运转正常,就用最小油门割草。我这个自从买来那一天就没有动过油门,因为第一次打火我也是照样喷一下,然后拉绳子,一下就着了。所以,不需要动油门。那个橡皮的东东,您看它已经老化到瘪进去了,完全坚硬了,没有了弹性。但因为我从来都没动过它,它的功能没有了。如果它漏油,就用橡胶泥(5 美元一个类似牙膏的东东)把它封死。



您看我这个割草机21年了,拉绳子一下就着火,令我邻居啧啧称奇。我告诉他买一罐气体燃油,他愣愣地看着它。老家伙一辈子不知道买过多少新割草机!他说数不过来了。没想到,这么简单的东东他一辈子竟然不知道!



您给发动机里灌入的汽油是液体的,进入气缸之前没有办法变成气体,就很难打着火。当转速大的时候,进入的空气把液体汽油从油面上吸入气缸,吸入的时候液体汽油变成气体汽油。但拉绳子的速度很慢,进入的空气少,所以很少的液体汽油被汽化,打不着火的原因就在于此。要男人而且用大力气猛拉绳子才行。但喷入气体的燃油,一下子就打着了,转起来后,高转速进入气缸的空气流速大就把大量的液体汽油变成气体汽油,这个过程叫汽化。



您明白了这个道理,就知道了该怎么做了。一罐可以用很多年,因为一次只喷一下即可。 图上的这个罐就是5年前买的,放在地下室窗台上干燥的地方。



您会纳闷:为何割草机制造厂不告诉大家这个奥秘?



我跟您说:如果100% 的人都知道这个了,每个割草机的寿命都是30 年以上,那割草机制造厂还不关门吗?同样的道理,如果卖割草机的商店告诉所有的购买割草机的这个奥秘,那他们也赚不到钱了。



您别以为我怕花钱买新的割草机。因为就是新的割草机我也不会傻乎乎的去按照说明书来拉绳子!而且,我没有必要去买新的,因为我这个旧的比您刚买来的新的打火还省事,我拉一下就着火,而您那新的也要嘎啦嘎啦地拉很多次!而且,您要先变油门、按橡皮疙瘩给液体汽油,然后才拉绳子。想想看,您开的车10 年发动机走了十几万甚至几十万英里,割草机10年连100迈都没走!就算1000 迈,那又该如何?发动机的寿命不是1000 迈甚至1万迈就报废的。所以,理论上只是割草机打不着火而被扔掉的,如果能轻易打着火,用几十年都跟新的毫无差别。反正我这个21年了,还是拉一次绳子就着火,运转起来跟新的一样。

Thursday, April 14, 2011

Windows下获取Logon Session信息

什么是LSA?什么是session?MSDN中的描述如下:




Local Security Authority



(LSA) A protected subsystem that authenticates and logs users onto the local system. LSA also maintains information about all aspects of local security on a system, collectively known as the Local Security Policy of the system.

(LSA) 一个判断用户登陆本系统时候的保护子系统。LSA也包含有关本系统中安全的所有方面,统称为本地安全策略的系统。

logon session



A logon session begins whenever a user logs on to a computer. All processes in a logon session have the same primary access token. The access token contains information about the security context of the logon session, including the user's SID, the logon identifier, and the logon SID.



当用户登陆计算机时,一个对应的logon session就开始了。一个logon session可以拥有多个进程,计算机上运行着的所有进程都属于一个唯一的session。怎么获取这些session和进程的相关信息呢?



LsaEnumerateLogonSessions函数可以获取已经存在的logon session identifiers (LUIDs) 和session的总数。



NTSTATUS NTAPI LsaEnumerateLogonSessions(

PULONG LogonSessionCount,

PLUID* LogonSessionList

);



当LogonSessionList不再需要时,需要调用LSAFreeReturnBuffer函数来释放所占用的内存。



看看刚才获取的LogonSessionList,数据类型为LUID。



typedef struct _LUID {

DWORD LowPart;

LONG HighPart;

} LUID, *PLUID;



为了通过LUID来获取详细的logon session信息,需要调用函数LsaGetLogonSessionData,调用者必须是拥有该session或者是本地的系统管理员。



NTSTATUS NTAPI LsaGetLogonSessionData(

PLUID LogonId,

PSECURITY_LOGON_SESSION_DATA* ppLogonSessionData

);



LsaGetLogonSessionData函数返回一个PSECURITY_LOGON_SESSION_DATA结构体。



typedef struct _SECURITY_LOGON_SESSION_DATA {

ULONG Size;

LUID LogonId;

LSA_UNICODE_STRING UserName;

LSA_UNICODE_STRING LogonDomain;

LSA_UNICODE_STRING AuthenticationPackage;

ULONG LogonType;

ULONG Session;

PSID Sid;

LARGE_INTEGER LogonTime;

LSA_UNICODE_STRING LogonServer;

LSA_UNICODE_STRING DnsDomainName;

LSA_UNICODE_STRING Upn;

} SECURITY_LOGON_SESSION_DATA, *PSECURITY_LOGON_SESSION_DATA;



其中包含了登陆标识(LogonId)、登陆的账号(UserName)、域(LogonDomain)、认证方式 (AuthenticationPackage)、登陆类型(LogonType)、会话ID(Session)、用户的Sid(Sid)、用户登陆时间 (LogonTime)等信息。



登陆类型(LogonType)是个枚举类型。



typedef enum _SECURITY_LOGON_TYPE {

Interactive = 2, // Interactively logged on (locally or remotely)

Network, // Accessing system via network

Batch, // Started via a batch queue

Service, // Service started by service controller

Proxy, // Proxy logon

Unlock, // Unlock workstation

NetworkCleartext, // Network logon with cleartext credentials

NewCredentials, // Clone caller, new default credentials

RemoteInteractive, // Remote, yet interactive. Terminal server

CachedInteractive, // Try cached credentials without hitting the net.

CachedRemoteInteractive, // Same as RemoteInteractive, this is used internally for auditing purpose

CachedUnlock // Cached Unlock workstation

} SECURITY_LOGON_TYPE, *PSECURITY_LOGON_TYPE;



用户的Sid(Sid)可以用ConvertSidToStringSid来转换成常见的SID格式字符串。



BOOL ConvertSidToStringSid(

PSID Sid,

LPTSTR* StringSid

);



这样,所有logon session的信息就获取到了。



更进一步的,用EnumProcesses函数枚举进程ID,OpenProcess获取每一个进程的句柄。在分别通过OpenProcessToken 和GetTokenInformation打开并获取进程的访问令牌信息。



BOOL OpenProcessToken(

HANDLE ProcessHandle,

DWORD DesiredAccess,

PHANDLE TokenHandle

);



BOOL GetTokenInformation(

HANDLE TokenHandle,

TOKEN_INFORMATION_CLASS TokenInformationClass,

LPVOID TokenInformation,

DWORD TokenInformationLength,

PDWORD ReturnLength

);



TokenInformationClass是个枚举类型,用来指明要获取的信息类型,这里用TokenStatistics即可。获取的信息在 TokenInformation中,数据类型为TOKEN_STATISTICS的结构体。



typedef struct _TOKEN_STATISTICS {

LUID TokenId;

LUID AuthenticationId;

LARGE_INTEGER ExpirationTime;

TOKEN_TYPE TokenType;

SECURITY_IMPERSONATION_LEVEL ImpersonationLevel;

DWORD DynamicCharged;

DWORD DynamicAvailable;

DWORD GroupCount;

DWORD PrivilegeCount;

LUID ModifiedId;

} TOKEN_STATISTICS, *PTOKEN_STATISTICS;



其中LUID AuthenticationId如果和前面logon session的LUID一致,说明该进程的拥有者是相应的logon session。



通过类似的方法,能获取很多有用的信息。下面的程序是用这些API写的一个windows下获取logon session信息,并列举属于该session的进程。

How do I build a backyard shelter for the patio?

I don't want an octagonal or hexagonal gazebo. I just need to make a square shelter. No walls needed. Or, I could use a square gazebo. Something simple and to keep the sun and rain off.


If you know of any websites or books/videos than would be helpful on this specific topic, please let me know.



It seems to me that it would be very simple to do. Kind of like a canopy bed, but without the bed, and, with an angled canopy/roof so that the rain will run off. But, if there's a tried-and-true way to do it, I would appreciate the info. :)



The section of the patio that I want to cover is 10' x 10'. I will make it out of cedar.

Best Answer - Chosen by Voters


We built ours using a Sunset book that is sold at the Lowes, Perogals, Patio Covers and Gazebos. It gives very detailed instructions and material lists for a wide variety of different patio covers. We actually combined the plans of two different designs to meet our needs and it was very simple to build, but it took this husband and wife team a few more days to complete the project than the book indicated.
 
It is easy to do do.


Just be sure the pitch is 1" per foot, or in your case, 10" pitch down for proper run off.

Use rigid material, I now have fiberglass panels that I bought at Home Depot. I originally had a canvas type awning, but it did not last.

If you live in the North, be sure it is properly supported to withstand the weight of snow.

How to build a pergola

http://www.youtube.com/watch?v=tqx1y_oBkkw&feature=related

How to Build a Backyard Patio Roof

Adding a roof to your patio offers shade and protection from the elements, and you can easily build a flat roof on your backyard patio with a frame and metal sheeting. If you prefer to have an open roof, build it with a lattice. Check your local building codes and determine the depth for your structure posts and to obtain any required permits for building your patio roof.

* 1
Measure the patio area to be covered. Metal roof sheeting is sold in a variety of lengths and widths, so take the overall dimensions of your patio roof to your local home supply store and they will advise you of the number of panels you need in order to cover your patio. You will also need treated wood posts to support the metal roof, every 8 feet around the perimeter of your patio. Treated plywood will provide the base for your metal sheets. Treated wood is mildew and insect resistant, so you should always use it for any outdoor project. All the materials for your patio roof can be found at your local home improvement supply store.

* 2
Measure 8-feet increments and mark the location for your support post holes. Dig the holes in accordance with your local building codes and guidelines.

* 3
Stand the posts in the holes and brace them perpendicular to the ground with wood stakes. Mix quick-drying cement according to the manufacturer's instructions and pour it around the posts. Let the cement dry.

* 4
Build the frame to hold the metal sheets by attaching the 2 by 8 treated wood planks to the support posts around the perimeter of your patio. Build the cross support of your frame spanning the patio with the 2 by 12 treated wood planks, cut to size if your patio is not 12 feet wide. If it is wider than 12 feet, you will need another line of posts in place to support the frame.

* 5
Attach the treated plywood sheets to the frame, beginning in a corner and working your way outward. This step is not absolutely necessary, but it will make the structure of your patio roof stronger and create a more cohesive covering.

Attach the first metal sheet to one corner on top of the frame with wood screws. Cover your patio with the metal sheets. Cut the final metal sheets as needed to fit with your tin snips.