rv = NS_AutoregisterComponents(); if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsIServiceManager> servMan; NS_InitXPCOM2(getter_AddRefs(servMan), nsnull, nsnull); nsCOMPtr<nsIComponentRegistrar> registrar = do_QueryInterface(servMan); NS_ASSERTION(registrar, "Null nsIComponentRegistrar"); registrar->AutoRegister(nsnull);
main(int argc, char* argv[]){    nsresult rv;    if (argc < 3) {        printf("usage: %s <file-prefix-to-write> <num-bytes>\n", argv[0]);        return -1;    }    char* fileName = argv[1];    int length = atoi(argv[2]);    rv = NS_AutoregisterComponents();    if (NS_FAILED(rv)) return rv;    rv = TestSyncWrites(fileName, 0, length);    NS_ASSERTION(NS_SUCCEEDED(rv), "TestAsyncRead failed");    return NS_OK;}